Iteration Exercise 2b

Develop a program using a repeat 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

    repeat until another area= "N" {continue to enter dimensions until the user terminates with a "N"}
        read shaded length        
        read shaded width
        non tiling area:= non tiling area + shaded length * shaded width
        display another area prompt
        read another area{ validate for "Y" or "N" } {ensure that there is a way to exit the loop}
    endrepeat

    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
Another area anotherArea char


PROGRAM: tilerpt.cpp