Advertisement
cgorrillaha

IntroPainting1

Oct 2nd, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. class Main {
  2.   public static void main(String[] args) {
  3.  
  4.     /* DECLARATIONS++++++++++++++++++++++++++++++++++++++ */
  5.     final int COVERAGE = 350; // paint covers 350 sq ft/gal
  6.     // declare integers length, width, and height;
  7.     int length, width, height;
  8.     // declare double totalSqFt;
  9.     double totalSqFt;
  10.     // declare double paintNeeded;
  11.     double paintNeeded;
  12.     // declare and initialize Scanner object
  13.     Scanner scan = new Scanner(System.in);
  14.  
  15.     /* inputs+++++++++++++++++++++++++++++++++++++++++++++++++++ */
  16.     // Prompt for and read in the length of the room
  17.     System.out.println("Please enter the length: ");
  18.     length = scan.nextInt();
  19.     // Prompt for and read in the width of the room
  20.     System.out.println("Please enter the width: ");
  21.     width = scan.nextInt();
  22.     // Prompt for and read in the height of the room
  23.     System.out.println("Please enter the height: ");
  24.     height = scan.nextInt();
  25.  
  26.     /* Calculations++++++++++++++++++++++++++++++++++++++++++++ */
  27.     // Compute the total square feet to be painted--think
  28.     // about the dimensions of each wall
  29.     totalSqft=(length*height*2)+(width*height*2);
  30.     // Compute the amount of paint needed
  31.     paintNeeded=totalSqFt/COVERAGE;
  32.  
  33.     /* Outputs+++++++++++++++++++++++++++++++++++++++++++++++++ */
  34.     // Print the length, width, and height of the room and the
  35.     // number of gallons of paint needed.
  36.     System.out.println("Length: "+length+"\nWidth: "+width+"\nHeight:"+height);
  37.     System.out.println("Total square feet: "+totalSqFt);
  38.     System.out.println("Paint needed: "+paintNeeded);
  39.  
  40.   }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement