Professional Documents
Culture Documents
Lab Assignment 1. WAP To Find The Volume of Any Cylinder Using Method 2. Wap To Find The Area of A Circle
Lab Assignment 1. WAP To Find The Volume of Any Cylinder Using Method 2. Wap To Find The Area of A Circle
Lab Assignment 1. WAP To Find The Volume of Any Cylinder Using Method 2. Wap To Find The Area of A Circle
class Cylinder{
Scanner input = new Scanner(System.in);
private double radius;
private double height;
private double PI = 3.14;
double volume;
public void getData(){
System.out.print("Enter radius for the cylinder: ");
radius = input.nextDouble();
System.out.print("\nEnter height for the cylinder: ");
height = input.nextDouble();
}
object.getData();
object.calculateVolume();
}
OUTPUT
SOURCE CODE
class Circle{
private double radius;
private double PI = 3.14;
private double area;
object.getRadius(5);
object.displayArea();
}
OUTPUT