CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: NoFormat

No Title

61 Views
Copy Code Show/Hide Line Numbers
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
 
import java.util.Scanner;
 
public class Paint
{
    public static void main(String[] args)
    {
        final int COVERAGE = 12;  //paint covers 12 sq meter/liter
        int length, width, height, windows, doors; //declare integers length, width, and height;
        double totalSqM; //declare double totalSqM;
        double paintNeeded; //declare double paintNeeded;
        
        Scanner scan = new Scanner( System.in );        //declare and initialize Scanner object
        System.out.println("Length: ");
        length = scan.nextInt();
 
        System.out.println("Width: ");
        width = scan.nextInt();
 
        System.out.println("Height: ");
        height = scan.nextInt();
          
          System.out.println("Windows: ");
        windows = scan.nextInt();
          
          System.out.println("Doors: ");
        doors = scan.nextInt();
 
        // Antar att det är 4 väggar vi ska måla:
        totalSqM = (double)( 2*(height * width) + 2*(length * height) );
        //Compute the amount of paint needed
        paintNeeded = totalSqM / COVERAGE;
        System.out.println( "Length: " + length + ", Width: " + width + ", Height: " + height + "Windows" - windows + "Doors" - doors);
        System.out.println( paintNeeded + " litre paint needed" );
    }
}
by Sara
  February 07, 2010 @ 8:04am

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate