/*
Author: Aaron Hurt
Class: COMP 313, Intro to Java
Time: Saturday, 8 to 1
Assignment: Homework 2
Program description:  Calculate paint needed
for a cabin given it's dimensions.
*/

public class Cabin {

	public static void main(String[] args) {
		//Set up constants
		final int sqFeetPerGallon = 100; //Paint coverage

		//Set up variables
		double lengthCabin; //Lenth of the cabin
		double widthCabin; //Width of the cabin
		double heightCabin; //Height of the cabin
		double widthDoor; //Width of the cabin's door
		double heightDoor; //Height of the cabin's door
		double widthWindow1; //Width of the cabin's 1st window
		double widthWindow2; //Width of the cabin's 2nd window
		double heightWindow1; //Height of the cabin's 1st window
		double heightWindow2; //Height of the cabin's 2nd window

		double doorArea; //Area of the door
		double window1Area; //Area of window 1
		double window2Area; //Area of window 2
		double wallArea; //Area of walls (total)
		double paintArea; //Area of paint surface
		double numberGallons; //Number of gallons required for painting

		//Get Input
		lengthCabin = GetData.getDouble("Enter cabin length");
		widthCabin = GetData.getDouble("Enter cabin width");
		heightCabin = GetData.getDouble("Enter cabin height");

		widthDoor = GetData.getDouble("Enter door width");
		heightDoor = GetData.getDouble("Enter door height");

		widthWindow1 = GetData.getDouble("Enter the width of window 1");
		heightWindow1 = GetData.getDouble("Enter the height of window 1");

		widthWindow2 = GetData.getDouble("Enter the width of window 2");
		heightWindow2 = GetData.getDouble("Enter the height of window 2");

		//Do Processing
		//Calculate wall area first

		wallArea = 2 * heightCabin * (widthCabin + lengthCabin);
		//Calculate door area
		doorArea = widthDoor * heightDoor;
		//Calculate window area
		window1Area = widthWindow1 * heightWindow1;
		window2Area = widthWindow2 * heightWindow2;
		//Subtract non-painted items from the wall area
		paintArea = Math.ceil(wallArea - doorArea - window1Area - window2Area);
		//How many gallons area required?
		numberGallons = Math.ceil(paintArea / sqFeetPerGallon);
		//If there was some leftover footage, get another gallon of paint.
		if (paintArea % sqFeetPerGallon > 0)
			numberGallons++;

		//Output results
		System.out.println("\n\nPAINT PROGRAM OUTPUT:");
		System.out.println("SQ FEET TOTAL: "+paintArea);
		System.out.println("GALLONS OF PAINT REQUIRED: "+numberGallons);
	}
}