Lab 2 -Given room that is 10 feet wide by 20 feet long by 8 feet tall. Assume th
ID: 3748519 • Letter: L
Question
Lab 2 -Given room that is 10 feet wide by 20 feet long by 8 feet tall. Assume there is a window that is 6 feet tall by 5 feet wide and a door that is 8 feet tall by 5 feet wide Calculate the total wall space that will need painting Calculate the total floor space that will need to be carpeted Print out the following where??? is the number square feet of wall or floor space Total wall space to be painted ???? Total floor space to be carpeted???? - Be sure to use good documentation Change Lab02 to read in the values instead of having them defined in your program Also a add book case that is 10.5 long, 8 high and 4 deep. Read in those values too. Remember it subtracts from both floor area and wall area.Explanation / Answer
TotalWallAndFloorSpace.java
import java.util.Scanner;
public class TotalWallAndFloorSpace {
public static void main(String[] args) {
double length,width,height;
double totWallSpace,totFloorSpace;
double wH=6,wW=5,dH=8,dW=5;
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
//Getting the input entered by the user
System.out.print("Enter the room length :");
length=sc.nextDouble();
System.out.print("Enter the room width :");
width=sc.nextDouble();
System.out.print("Enter the room height :");
height=sc.nextDouble();
//Calculating the area of 4 walls of the room
totWallSpace= (2 * height * (length + width))-(wH*wW)-(dH*dW);
totFloorSpace=length*width;
System.out.println("Total WallSpace painted :"+totWallSpace);
System.out.println("Total FloorSpace carpeted :"+totFloorSpace);
}
}
_________________
Output:
Enter the room length :10.5
Enter the room width :4
Enter the room height :8
Total WallSpace painted :162.0
Total FloorSpace carpeted :42.0
_________Thank You
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.