Can I Get assistance to assure that the pseudo code is correct for the following
ID: 3569505 • Letter: C
Question
Can I Get assistance to assure that the pseudo code is correct for the following problem..?
You are to buy paint two walls (each 12ft by 12ft). One wall has a door (not to be painted) which is 7ft x 4ft. The other wall has two windowa each 4ft x 3 ft. One gallon of paint can cover 100 sq. ft. Write the pseudo code to calculate how much paint to buy.
Main ()
Constant Real AreaOfWall = 12*12
Constant Real AreaOfDoor = 7 * 4
Constant Real AreaOfWindow = 4*3
Declare Real AreaToPaintWallOne
Declare Real AreaToPaintWallTwo
Declare Real TotalPaintToBuy
Constant Real TotalPainToBuy = 100
//Calculating how much paint
AreaToPaintWallOne = AreaOfWall
Explanation / Answer
The mistake in the pseudo code is that the AreaOfWindow is not multiplied by 2 while calculating the AreaToPaintWallTwo. The number of windows of the wall two is two. Since the AreaOfWindow should be multiplied with 2.
Remaining part is correct.
Main ()
Constant Real AreaOfWall = 12*12
Constant Real AreaOfDoor = 7 * 4
Constant Real AreaOfWindow = 4*3
Declare Real AreaToPaintWallOne
Declare Real AreaToPaintWallTwo
Declare Real TotalPaintToBuy
Constant Real TotalPainToBuy = 100
//Calculating how much paint
AreaToPaintWallOne = AreaOfWall – AreaOfDoor
AreaToPaintWallTwo = AreaOfWall – AreaOfWindow + 2*AreaOfWindow
TotalPaintToBuy = AreaToPaintWallOne + AreaToPaintTwo / TotalPaintToBuy
//Displaying total paint to buy
Display “The total amount of pain to buy” ,TotalPaintToBuy
End Main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.