Vous êtes sur la page 1sur 2

COMPUTER SCIENCE (083)

Ass# 3 (Selection Statements if, switch)


1. Write a program to accept the three coefficients of a quadratic equation
ax2 + bx + c. Calculate and find out whether the roots are real or imaginary, display them
accordingly.
2. Write a program to calculate the Telephone bill for a company ABC Ltd. The program
accepts the Telephone no., Customer no., previous call reading, and current call reading.
Calculate and display the number of calls, Call charges, Monthly service charges, Service tax
+ Edu cess and Amount to be paid.
No. of calls = Current call reading previous call reading
The Call Charges are calculated based on the following criteria:
Calls
Charges(Rs.)
0 - 60
Nil
61 - 300
0.80
301 - 2000
1.20
> 2000
1.00
The Monthly Service Charges is Rs. 250.
The Service Tax + Edu cess is 10.3% of (Call Charges + Monthly Service Charges)
The Amount to be paid is Call Charges + Monthly Service Charges + Service Tax and Edu cess.
3. A taxi meter has the following method of billing
Rs. 25/- for first Kilometer
Rs. 20/- for next 4 Kilometers
Rs. 18/- for the next 8 kilometers
Rs. 15/- per kilometer for any distance above 13 kilometers
Write a program that will input the number of kilometers and generate a bill.
4. Write a program to calculate the Electricity bill. The program accepts the Meter no.,
previous meter reading, and current meter reading. Calculate the No. of units consumed as
Current meter reading previous meter reading and display the Unit Charges based on the
following criteria:
No. of Units
Charges (Rs.)
0 - 200
2.45
201 - 400
3.95
> 400
4.65
The Fixed Charge is Rs. 100.
The Electricity Tax is 5% of (Unit Charges + Fixed Charge)
The Amount to be paid is Units Charges + Fixed Charges + Electricity Tax.
5. Write a program to calculate the Income Tax of the financial year 2015-2016. The program
accepts the Taxable income and calculates the Tax based on the following criteria:
Income (Rs.)
Tax
Nil to Rs. 160,000/-

NIL

160,001 500,000

10%

500,001- 800,000

20%

800,001 & Above

30%

Educational Cess is 3% of Income tax.


Total tax to be paid is Income tax + Educational Cess
6. At a recruitment centre for the armed forces, the height and chest of the candidates are
measured in cms and weight in kg.
A candidate is accepted if the height is more than 150cm, weight is more than 50 kg and
chest is more than 80cm. Furthermore, the weight to height ratio must be at least 0.33 but not
more than 0.5.
An accepted candidate is placed in one of the three groups according to the weight to height
ratio.
If the ratio is more than 0.4 but less than 0.45 he is placed in group 2.
If the ratio is 0.4 or less but more than 0.33 he is put in group 1, otherwise in group 3.
Write a program to accept registration no., height, chest & weight of the
candidate and
assign an appropriate group to the candidate if he is selected else
display the message not
selected.

Vous aimerez peut-être aussi