[go: up one dir, main page]

0% found this document useful (0 votes)
31 views4 pages

Conditional Statements Programs Ws

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

Conditional Statements Programs Ws

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PRESIDENCY SCHOOL

Worksheet 4

Grade: 9 Subject:Computer

Class : IX IF-ELSE and SWITCH Page.1


1. WAP to print the larger of two numbers entered from the keyboard.
2. WAP to accept a number from keyboard and check whether it is a positive number,
negative number or zero .print suitable message.
3. WAP a program to check a number to be Odd or even. Print suitable message for the number.
4. A voter is eligible to vote the election held in his city if his age is at least 18 yrs. Define a
class Eligibility test that checks for the eligibility of a voter.
5. Write a program that returns the commission in rupees for a
salesman: The commission is based on the following condition:
Sales Commission
<Rs 5000 5%
Rs 5000 to Rs 10000 8%
Above Rs 10000 10%

6. Write a program to accept a day number from the user and print the corresponding day name.
make use of switch-case construct.
7. WAP to accept a month number and print the corresponding month name. make use
of switch-case construct.
8. Define a java class maximum to print the largest out of the three numbers accepted from the user.
9. WAP to check the divisibility of number a by another number say b.

10. An electricity board charges the bill depending on the number of units consumed as follows.
Units Charge
First 100 units 40 ps/per unit
Next 200 units 60 ps/per unit
Above 300 Rs 1 per unit

11.WAP class Leap to accept an year and check if it a leap year or not.
12. WAP to accept the length of three sides of a triangle and print appropriate message for the type
it belongs to e.g. Scalene, Equilateral or Isosceles.

13. WAP to compute the amount that a customer pays for the taxi that he hires based on the
following condition:
Kms Travelled Amount per km
First 10 kms 25
Next 20 kms 10
Next 40 kms 15
Above 70 kms 12
Input the customer name, the taxi number and the number of kilometers travelled by him.
Class : IX IF-ELSE and SWITCH Page.2
14. WAP to compute the net amount paid by the customer.
Amount of purchase Mill cloth Handloom Item
Less than Rs 1000 2% 5%
Rs 1000 to Rs 5000 20% 25%
Above 5000 40% 50%

15. WAP to input 3 angles of a triangle check & print whether it is acute ,obtuse or right angle triangle.if
angle is less than 90 is acute.
16. WAP to print any no check & print whether it is BUZZ no or not. //it is divided by 7 and remainder is 7.
17. WAP any no check & print whether it is Appropriate no or not.
18. WAP to compute the tax according to the given conditions and display the output.
Total Annual Taxable Income Tax Rate
Up to Rs 100000 No tax
From Rs. 100001 to Rs. 150000 10% of the income
Above 150000 30%

19. A cloth showroom has announced the following festival discount on the total cost of item
purchased, WAP to input the total cost and display the amount to be paid by the purchaser.
Total Cost Discount
upto 2000 15%
>2000 to 5000 25%
> 5000 to 10000 35%
>10000 50%

20. WAP to input CP & SP of an article calculates & print its Profit% or loss% .if CP & SP are equal then print
no profit no loss.

21. WAP to input total no of monthly calls, calculate & print the monthly tel. bill as given
criteria. No of Calls Call Rate
First 100 80 ps./call
Next 200 60 ps./call
Beyond 300 40 ps./call

22. Define a class to accept sales of a salesman and print his commission according to the following criteria.
Sales(s) Commission
50000 onward s 15%
33000 <=s <50000 9%
18000 <=s <33000 6%
6000 <=s <18000 3%
0 <=s <6000 0%
Class : IX IF-ELSE and SWITCH Page.3
23. To foster a sense of water conservation, the water department has an annual water conversion tax
policy. The rates are based on the water consumption of the consumer.
The tax rules are as follows:
Water consumed (Gallons) Tax rate (in Rs.)
More than 45 but 75 or less 475.00
More than 75 but 125 or less 750.00
More than 125 but 200 or less 1225.00
More than 200 but 350 or less 1650.00
More than 350 2000.00

24. An electricity board charges the following rates to domestic users to discourage large consumption
of electricity.
Units Charge
First 100 units 40 ps/per unit
Next 200 units 60 ps/per unit
Above 300 Rs 1 per unit

If the bill is above Rs. 1000 upto Rs. 2000 an extra surcharge of 10% is added. If the bill amount is above Rs.
2000 a surcharge of 20% is added.
Write a program to enter the units consumed and print the bill in the proper format.

25. An employee is entitled to pay an income tax based on his gross annual income as
follows: Annual gross income Annual tax deduction
Less than or equal to Rs. 100000 0%
100001 to 500000 Rs. 1000 + 10% of income exceeding Rs. 100000
500001 to 800000 Rs. 5000 + 20% of income exceeding Rs. 500000
> 800000 Rs. 10000 + 30% of income exceeding Rs. 800000
Write a program to accept the monthly salary of a person and print the annual tax paid by the salaried person.

26. Write a program to enter item no., quantity purchased and rate. Calculate the total purchase price and print
it with the gifts. The to be the customers are given in the following manner:

Amount of Purchase(Rs) Gift


100 and above but less than 500 a key ring
500 and above but less than 1000 a leather purse
1000 and above a pocket calculator

27. A library charges fine according to the number of a book is returned late, according to the following criteria:
Days Fine per day
First 10 days Rs. 1
Next 10 days Rs. 1.50
Next 20 days Rs. 2.00
WAP to enter the number of days a book is returned late and print the fine to be paid.
Class : IX IF-ELSE and SWITCH Page.4
28. A cloth showroom offers discounts in its regular stock clearance sale as per follows:
Amount of purchase Discount in %
Cloth material Readymade garments
Less than or equal to 500 3% 2%
Greater than 500 upto 2000 8% 5%
Greater than 2000 upto 5000 12% 10%
Greater than 5000 20% 15%

WAP to accept the amount of purchase and type of purchase where ‘R’ indicates readymade garments and ‘C’
indicates cloth material either calculate discount and the discounted price for cloth material or readymade
garment depending on the type.

29. A Computer shop has announced the following festivals discounts on purchase of items.
Amount of purchase Discount in %
Laptop Desktop
Less than or equal to 20000 3% 2%
Greater than 20000 upto 50000 8% 5%
Greater than 50000 upto 100000 12% 10%
Greater than 100000 20% 15%

Write a java program to compute the net amount paid by the customer. Assume all required values to be
inputted by the user. Make use of if and switch structure.

30. Using a switch statement, write a menu driven program to convert a given temperature from Fahrenheit
to Celsius and vice versa. For an incorrect choice, an appropriate error message should be displayed:
(Hint: C=5/9 *(F-32) and F=1.8*C+32)

You might also like