Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using Java. Two separate programs. Lab 01 - Calculate wall and floor space to be

ID: 3731405 • Letter: U

Question

using Java.
Two separate programs.

Lab 01 - Calculate wall and floor space to be covered
– 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

>
>
.
Lab 02 - read in values for Lab 02

Change Lab01 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.   Remember it subtracts
from both floor area and wall area.
      (copy Lab02)    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 = ??

Explanation / Answer

Note: The following program first calculates the total wall space without excluding the area of the window & the door, then it calculates the area of the window & the door according to their dimensions & subtract the result from the total wall space. As dimensions of all the four walls is not the same, we need to calculate them seprately. There are two walls with dimension width & height, & two walls with dimension length & height. Further read the comments to understand the program.


class Lab01
{

public static void main(String as[])
{
double wallspc, wallspc1, wallspc2, floorspc, wndspc, doorspc, wdth, lngth, hgt, wndwdth, wndhgt, doorwdth,

doorhgt, subspc;
wdth=10;
lngth=20;
hgt=8;
wndwdth=5;
wndhgt=6;
doorwdth=5;
doorhgt=8;
floorspc=wdth*lngth; /* floor space */
wallspc1=wdth*hgt; /* Wall space according to the width & height */
wallspc1=wallspc1*2; /* As there are 2 walls which have same dimension width & height */
wallspc2=lngth*hgt; /* Wall space according to the length & height */
wallspc2=wallspc1*2; /* As there are 2 walls which have same dimension length & height */
wallspc=wallspc1+wallspc2; /* Total wall space without subtracting window & door */
doorspc=doorwdth*doorhgt;
wndspc=wndwdth*wndhgt;
subspc=wndspc+doorspc;
wallspc=wallspc-subspc; /* Wall space after subtracting window & door */
System.out.println("Total wall space to be painted = " + wallspc);
System.out.println("Total floor space to be carpeted = " + floorspc);
}
}