Advertisement
Mhazard

Java CaylinderCal

Sep 26th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. // 15101194S
  2.  
  3. //Import Scanner
  4. import java.util.Scanner;
  5. public class CylinderCal
  6. {
  7.     public static void main(String[] args)
  8.     {
  9.         //Scanner
  10.         Scanner sc = new Scanner(System.in);
  11.         System.out.print("Please enter the radius: ");
  12.         //insert radius
  13.         double Radius = sc.nextDouble();
  14.         System.out.print("Please enter the height: ");
  15.         //insert height
  16.         double Height = sc.nextDouble();
  17.         //Surface Area
  18.         double Result1 = 2 * Math.PI * Radius * Height;
  19.         System.out.println("The surface area is " + Result1);
  20.         //Volume
  21.         double RadiusSquare = Radius * Radius;
  22.         double Result2 = Math.PI * RadiusSquare * Height;
  23.         System.out.println("The Volume is " + Result2);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement