Practical Assignment
2023-2024
(Solve all the programs)
1) Write a Java program to calculate and display the area of a circle (area = πr2)
2) Write a Java
program to calculate and display the volume of the cylinder (volume = πr2h)
3) Write a Java
program to accept a temperature in Fahrenheit and convert the temperature from
Fahrenheit to Celsius. (c= (F - 32) × (5/9)).
4)
Write a Java
program to input two numbers and perform the following operations using Math
class functions.
(a) print the largest number between two numbers.
(b) print the smallest number between two numbers.
(c) print the square root of the first number.
(d) print the cube root of the second number.
(e) print power of the first number raised by the second
number.
5) Write a Java program to print whether the number is positive or negative, using the “if else” statement.
6)
Write a Java
program to print whether the number entered is even or odd, using the “if else”
statement.
7)
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.
8)
Write a Java
program to input two numbers and swap their values without using a third
variable.
9)
Write a Java
program to print whether the number is a BUZZ number or not, using the “if
else” statement.
10) Write a Java program to print whether the number is
zero, positive, or negative, using the “nested if” statement.
11) Write a Java program to check whether the entered
character is in the digit or letter.
12) Write a Java program to check whether the entered
character is a vowel or consonant.
13)
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.