Conditional Construct
Section B
2006
Question 5
A cloth showroom has announced the following festival discounts on the purchase of items, based on the total cost of the items purchased:
Total cost | Discount |
5000 or above | 5% |
Rs. 2001 to Rs. 5000 | 25% | Rs.5001 to Rs.10000 | 35% |
Above Rs. 10000 | 50% |
Write a program to input the name of the customer and cost, to compute and display the bill as follows.
NameCostNet amountxxxxxxxxxxxxxxxxxxxxx[15]
Variable Description
Variable | Type | Description |
---|---|---|
cost | double | Purchase amt |
dis | double | Discount |
net | double | Net amount |
2009
Question 4
An electronics shop has announced the following seasonal discounts on the purchase of certain items.
Purchase amount | Discount on Laptop | Discount on Desktop PC |
---|---|---|
0 – 25000 | 0% | 5% |
25001 – 57000 | 5% | 7.5% |
57001 – 100000 | 7.5% | 10% |
More than 100000 | 10% | 15% |
Write a program based on the above criteria, to input name, address, amount of purchase and type of purchase (L for Laptop and D for Desktop) by a customer. Compute and print the discount and net amount to be paid by a customer along with his name and address.
(Hint: discount = (discount rate/100)*amount of purchase
Net amount = amount of purchase - discount [15]
2012
Question 5
Given below is a hypothetical table showing rates of income tax for male citizen below the age of 65 years:
Taxable Income (TI) in Rs. | Income Tax in Rs. |
Does not exceed Rs. 1,60,000 | Nil |
Is greater than Rs. 1,60,000 & less than or equal to Rs 5,00,000 | (TI – 1,60,000) x 10% |
Is greater than Rs. 5,00,000 & less than or equal to Rs 8,00,000 | [(TI – 5,00,000) x 20%] + 34,000 |
Is greater than Rs. 8,00,000 | [(TI – 8,00,000) x 30%] + 94,000 |
Write a program to input the age, gender (male or female) and Taxable Income of a person. If the age is more than 65 years or the gender is female, display “wrong category”. If the age is less than or equal to 65 years and the gender is male, compute and display the Income Tax payable as per the table given above. [15]
2014
Question 5
A special two-digit number is such that when the sum of its digits is added to the product of the digits, the result is equal to the original two-digit number.
Example: Consider the number 59. Sum of its digits = 5+9 = 14 Product of its digits = 5*9 = 45
Sum of the Sum of its digits and Product of its digits = 14 + 45 = 59
Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input,
output the message “Special 2 digit number” otherwise output the message “Not a special 2 digit number”. [15]