Basic JAVA Programs Worksheet For Beginners
Basic JAVA Programs Worksheet For Beginners
10. Write a program to find out the simple Interest and the Amount.
(FORMULA : Simple Interest = Principle x Rate x Time / 100)
Amount = Principle + Simple Interest
13. Write a program to interchange the value of two numbers without using the third variable.
14. Write a program to calculate the tax for a taxable income of Rs. 4,10,000, if the tax rate is fixed
at 3.2%.
15. Create a program that will generate a bill at McDonald's for four vegetable burgers (@ Rs 45
per vegetable Burger) and three vegetable McPuffs (@ Rs 25 per vegetable McPuff). There is a
special Independence Day discount of Rs 50 on the final bill amount.
16. The average height of 6 boys is 158 cm. When the seventh boy joins the group the average
height changes to 159 cm. Find the height of the seventh boy in the group. Write a program to
store the above data and find and display the height of the seventh boy.
17. Write a program that will compute and display the total bill where a loaf of bread costs Rs. 23.5
and an egg costs Rs. 5.75, where the user enters the loaf of bread and number of eggs to
purchase.
18. An alloy consists of 13 parts of copper, 7 parts of zinc and 5 parts of nickel. What is the
percentage of each alloy in the metal? Write a Java program to store all values and calculate
and display the percentage of each metal.
19. A train covers 120.5 km in 2.3 hours, next 160.75 km in 3.5 hours and the last 140.9 km in 5.5
hours. Write a Java program to store all values and calculate and display average speed.
20. Write a program in Java to input number of days. Find and display number of years, months and days.
21. Write a program to input cost price and selling price. Find and display profit and profit percent or loss or loss
percent. If CP equal to SP display NO PROFIT – NO LOSS.
22. Write a program in Java to input an integer, test and print if the number is Negative or positive.
23. Write a program in Java to input an integer, test and print if the number is EVEN or ODD.
24. Write a program in Java to input two integer numbers. If the first number is greater than the 2nd number,
then print the greater number and it’s double otherwise print the smaller number and its square root.
25. Write a program in Java to input an integer, test and print whether it is perfect square or not. Print
appropriate message.
26. Write a program to input two angles. Find and display it forms a Complementary Angle or not.
27. A wholesaler gives incentives in the form of discounts on the net bill. Write a program to input the net bill
and calculate the discount as follows:
Net Bill in Rupees Discount %
<5000 5%
>=5000 and <10000 10%
>=10000 15%
28. Write a program that will allow the teacher to input the marks obtained in Physics, Chemistry and Biology.
Find and display average marks and grade. Grade is as follows:
AVERAGE GRADE
0 to 50 C
51 to 70 B
71 to 90 A
91 to 100 *
Write a program to input sales amount. Calculate and display the commission% and commission amount
paid to the sales person.