# assignment lab 1

This program will determine the usable area of a house. The rooms are rectangular in shape and maximum of four rooms are allowed to be calculated at once. It will use the area formula for a rectangle to find the usable area of each room and once the calculation are made for each room it will print out the total usable area of a house to the output screen. Analysis

This program will calculate the usable area in square feet of a house with a maximum of four rooms that are rectangular in shape. The first step would be to get the required input because that is needed for the output. The first step is to get the each of the four rooms’ length and width. Then assign it to the appropriate variable. The area of a rectangle is the length multiply by the width. Then calculate the area of each room by multiplying the length by the width to find the number of square feet. Then we can find the total area by adding all the areas calculated together and that will result in the usable area of the house in square feet. We will use sequential programming statements.

The variables that will be used to find the area square feet of each room are: area, length, width Totalarea. Area will be used to find the usable square footage of each room. Length and width will be the input that we need to know to get the area of each room. Totalarea will be the sum of the area of each of the rooms that will be calculated. Equations to the area are listed below.

Area of Room1 = length1 * width1

Area of Room2 = length2 * width2

Area of Room3 = length3 * width3

Area of Room4 = length4 * width4

totalArea = Room1+Room2+Room3+Room4

Print the totalArea

Design

Pseudo code

//This program will multiply the length and width of a maximum of four rooms in a house //It will add the sum of the area of each room and assign it to the totalArea //declare variables

Declare length1, width1, length2, width2, length3, width3, length4, width4, areaRoom1, areaRoom2, areaRoom3, areaRoom4 and totalArea as Float Declare rooms as integer

Input length1, width1, length2, width2, length3, width3, length4, width4, Calculate

Set areaRoom1 = length1 *width1

Set areaRoom2 = length2 *width2

Set areaRoom3 = length3 *width3

Set areaRoom4 = length4 *width4

Set totalArea = areaRoom1 + areaRoom2 +areaRoom3 + areaRoom4 //Print totalArea

Print totalArea

Testing

Test Case#InputOutput

1Room1: length=2, width=6

Room2: length=8, width=14

Room3: length=16, width=22

Room4: length=24, width=30 1196 square feet

2Room1: length=2.2, width=6. 12

Room2: length=1.1, width=3.3

Room3: length=7.7, width=4.28

Room4: length=5.5, width=5.25 78.925 square feet

3Room1: length=3, width=9

Room2: length=5, width=12

Room3: length=8, width=3

Room4: length=4, width=3 123 square feet

Each of the tests cases Output pass and did not fail. The only way the program failed was if a character was the input versus a number. Documentation

//Then it will give the usable area of the house from total area of the sum of each of the rooms //Developer: Student CMIS102

//Date: August 28, 2014

#include

int main ()

{

/*variable definition*/

float length1, width1, length2, width2, length3, width3, length4, width4, areaRoom1, areaRoom2, areaRoom3, areaRoom4; /*variable initialization*/

length1 = 2;

width1 = 6;

length2 = 8;

width2 = 14;

length3 = 16;

width3= 22;

length4 = 24;

width4 = 30;

/*calculate total area of each room*/

areaRoom1 = (length1 *width1);

areaRoom2 = (length2 *width2);

areaRoom3 = (length3 *width3);

areaRoom4 = (length4 *width4);

/*variable definition*/

float totalArea;

/* get the total area of all the room*/

totalArea =( areaRoom1 + areaRoom2 +areaRoom3 + areaRoom4);

/*print the usable area of house*/

printf ("The total usable area of your house in square feet is: %f\n", totalArea);

return 0;

}

IDEONE

//Student CMIS102

//Date: August 28, 2014

#include

int main ()

{

/*variable definition*/

float length1, width1,...

Please join StudyMode to read the full document