Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.math.*;
- public class ContainerCalculator
- {
- public static void main(String[] args)
- {
- double r, h, d, volume;
- Scanner scnr;
- System.out.println("Welcome to the Container Calculator!");
- System.out.println("====================================");
- scnr = new Scanner(System.in);
- System.out.println("Enter the diameter of a cylinder(in centimeters): ");
- d = scnr.nextDouble();
- System.out.println("Enter the height of a cylinder (in centimeters): " );
- h = scnr.nextDouble();
- r = 1/2 * d;
- volume = ((22*r*r*h)/7);
- System.out.println("your volume is: " + volume);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement