0% found this document useful (0 votes)
9 views

If and Switch Assignments To Do

Uploaded by

Mr. Robot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

If and Switch Assignments To Do

Uploaded by

Mr. Robot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

If and Switch Assignments

1. Write a Java program to input basic salary of an employee and calculate its Gross salary
according to following: Basic Salary <= 10000 : HRA = 20%, DA = 80% Basic Salary <= 20000 :
HRA = 25%, DA = 90% Basic Salary >20000 : HRA = 30%, DA = 95%

2. Same program as No 1 using ternary

3. Write a Java program to input marks of five subjects Physics, Chemistry, Biology,
Mathematics and Computer. Calculate percentage and grade according to following: Grade
A if percentage >= 90% Grade B if percentage >= 80% Grade C if percentage >= 70% Grade D
if percentage >= 60% Grade E if percentage < 50%

4. Write a Java program to input electricity consumption unit and calculate total electricity
bill according to the given condition: For first 50 units Rs. 0.50/unit For next 100 units Rs.
0.75/unit For next 100 units Rs. 1.20/unit For unit above 250 Rs. 1.50/unit An additional
surcharge of 20% is added to the bill

5. Write a Java program print total number of days in a month using switch case

6. Write a Java program to check whether a number is even or odd using switch case

7. Write a Java program to create Simple Calculator using switch case

8. ATM Machine has Notes available of 100,200,500,and 2000. Enter amount to withdraw
from ATM machine. Display which and how many notes of each will be disbursed from
ATM.

9. Create Menu Card of Hotel. Accept a menu to order and quantity. Write a program to
generate a bill of respective order. Each Menu has sub menus. Eg.

______Menu_____

1. Panjabi
a. Mutter Paneer
b. Kofta curry
c. Butter Nan
2. Maharashtrian
a. -----
b. ------
c. ----

______________________________

DO it using wsitch case statements.

10. Write a program to display toggle case of entered characers.


11. Write a Java program to convert days into years, weeks and days.

You might also like