Padd Solutions

Converted by Falcon Hive

import java.util.Scanner;

public class Paint
{
    public static void main(String[] args)
    {
        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 thing = new Scanner (System.in);

        //Prompt for and read in the length of the room
        System.out.print ("What is the length of the room in feet? ");
        length = thing.nextInt ();

        //Prompt for and read in the width of the room
        System.out.print ("What is the width of the room in feet? ");
        width = thing.nextInt ();

        //Prompt for and read in the height of the room
        System.out.print ("What is the height of the room in feet? ");
        height = thing.nextInt ();

        //Compute the total square feet to be painted--think
        //about the dimensions of each wall
        totalSqFt = ( (height*width) +  (height*length) + (height*width) + (height*length) );
       
        //Compute the amount of paint needed
        paintNeeded = (totalSqFt / COVERAGE);
       
        System.out.println ();

        //Print the length, width, and height of the room and the
        //number of gallons of paint needed.
        System.out.println ("Your room is "+totalSqFt+"("+length+"x"+width+"x"+height+") sq ft, and it requires "+paintNeeded+" gallons of paint.");
       
    }
}

(0) Comments

Post a Comment