Language: NoFormat
No Title
/*
* 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" );
}
}
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

