Homework 1
The task at hand is to design a program, using pseudocode, which will calculate the square feet of a house with no more than four rooms. It must be additionally assumed that each of these rooms is rectangular. The required output is the accurate calculation of the aggregate square footage of these rooms. The required input to arrive at this output is the length and width of each of the rooms, the multiplication of each individual room length and width, and the sum of the combined multiplication results. The required output will be obtained through proper declaration of each variable, which consists of multiple floating point values. For my analysis the length of a room will be represented as L plus a number to identify the room, such as L1. The width will similarly be represented as W1, and the area, or length times width, as A1. The resulting output, or sum of all A values, will be calculated. The following is a list of the required input and resulting output.
RoomName as String
L1 as Float
L2 as Float
L3 as Float
L4 as Float
W1 as Float
W2 as Float
W3 as Float
W4 as Float
A1=L1*W1 A2=L2*W2 A3=L3*W3 A4=L4*W4
TotalSqFt=A1+A2+A3+A4
Using this design, The following pseudocode has been produced:
Main module Declare Room1Name as String Declare Room2Name as String Declare Room3Name as String Declare Room4Name as String Declare YorN as Character Declare Room1Length As Float Declare Room2Length As Float Declare Room3Length As Float Declare Room4Length As Float Declare Room1Width As Float Declare Room2Width As Float Declare Room3Width As Float Declare Room4Width As Float Declare Room1SqFt as Float Declare Room2SqFt as Float Declare Room3SqFt as Float Declare Room4SqFt as Float Declare TotalSqFt as Float Write “Total Square Footage Program” Write “This program computes the square footage of up to four” Write “individual rooms and the total square