Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Main {
- public static void main(String[] args) {
- /* DECLARATIONS++++++++++++++++++++++++++++++++++++++ */
- final int COVERAGE = 350; // paint covers 350 sq ft/gal
- // declare integers length, width, and height;
- int length, width, height;
- // declare double totalSqFt;
- double totalSqFt;
- // declare double paintNeeded;
- double paintNeeded;
- // declare and initialize Scanner object
- Scanner scan = new Scanner(System.in);
- /* inputs+++++++++++++++++++++++++++++++++++++++++++++++++++ */
- // Prompt for and read in the length of the room
- System.out.println("Please enter the length: ");
- length = scan.nextInt();
- // Prompt for and read in the width of the room
- System.out.println("Please enter the width: ");
- width = scan.nextInt();
- // Prompt for and read in the height of the room
- System.out.println("Please enter the height: ");
- height = scan.nextInt();
- /* Calculations++++++++++++++++++++++++++++++++++++++++++++ */
- // Compute the total square feet to be painted--think
- // about the dimensions of each wall
- totalSqft=(length*height*2)+(width*height*2);
- // Compute the amount of paint needed
- paintNeeded=totalSqFt/COVERAGE;
- /* Outputs+++++++++++++++++++++++++++++++++++++++++++++++++ */
- // Print the length, width, and height of the room and the
- // number of gallons of paint needed.
- System.out.println("Length: "+length+"\nWidth: "+width+"\nHeight:"+height);
- System.out.println("Total square feet: "+totalSqFt);
- System.out.println("Paint needed: "+paintNeeded);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement