Program to calculate Volume, Curved Surface Area and Total Surface Area of Cylinder in Java ?
Output of the program :
package com.hubberspot.mensuration.example;
import java.util.Scanner;
public class Cylinder {
   public static void main(String[] args) {
     Scanner input = new Scanner(System.in);
     double radius = 0;
     double height = 0;
     double volume = 0;
     double curvedSurfaceArea = 0;
     double totalSurfaceArea = 0;
     System.out.print("Enter the radius of base of Cylinder : "); 
     radius = input.nextDouble();
  
     System.out.print("Enter the height of Cylinder : "); 
     height = input.nextDouble();
     volume = (Math.PI * radius * radius * height);
     curvedSurfaceArea = 2 * (Math.PI * radius * height);
     totalSurfaceArea = 2 * Math.PI * radius * (radius + height);
  
     System.out.println("");
     System.out.println("The Volume of Cylinder is : " + volume);
     System.out.println("The Curved Surface Area of Cylinder is : "
                   + curvedSurfaceArea);
     System.out.println("The Total Surface Area of Cylinder is : "
    + totalSurfaceArea);
   }
}
Output of the program :
