Iteration Exercise 2a

Develop a program using a while loop, that will allow any number of shaded area to be entered and the areas to be tiled calculated.

Algorithm

TileCalculation
    read room length
    read room width
    non tiling area:= 0

    read shaded length
    while shaded length > 0 do {continue to enter dimensions until shaded length = 0}
        read shaded width
        non tiling area:= non tiling area + shaded length * shaded width
        read shaded length {ensure that there is a way to exit the loop}
    endwhile

    area to tile:= room length * room width - non tiling area
    write area to tile
End.


Data Item Table

Data Item Program name Size/Type Range
Room length roomLength float
Room width roomWidth float
Non tiling area nonTiling float
Shaded length shadedLength float
Shaded width shadedWidth float
Area of tile areaToTile float


PROGRAM: tilewhle.cpp