Practical Assignment
2024-2025
1) Write a Java program to calculate and display the volume of the cylinder (volume = πr2h)
i. Principle Amount = Rs. 20000ii. Rate = 8.9%iii. Time = 3 years
3) Write a Java program to print whether the number is positive or negative, using the “if else” statement.
4) Write a program in Java to accept three numbers and check whether they are Pythagorean Triplet or not. The program must display the message accordingly. [Hint: h2=p2+b2]
5) Write a Java program to input two numbers and swap their values without using a third variable.
6) Write a Java program to check whether the number entered is divisible by 3 as well as 5. Otherwise, decide:
(a) Is the number divisible by 3 and not by 5?
(b) Is the number divisible by 5 and not by 3?
(c) Is the number neither divisible by 3 nor by 5?
The program displays the message accordingly.
7) A cloth showroom has announced the following festival discounts on the purchase of items, based on the total cost of the items purchased:
availing the discount.
Weight | Charges |
---|---|
Upto 10 Kg. | Rs. 30 per Kg. |
For the next 20 Kg. | Rs. 20 per Kg. |
Above 30 Kg. | Rs. 15 per Kg. |
Write a program in Java to calculate the charge for a parcel, taking the weight of the parcel as an input.