Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C++ program to do the following Get the number of rooms. Get the tile size in inches. We are given that the tile

Create a C++ program to do the following

image text in transcribed

Get the number of rooms.

Get the tile size in inches. We are given that the tile is a square, thus the length and width of the tiles are the same.

Start of main loop

The number of rooms is the control variable for your main logic loop. You will repeat this logic for each room and exit the loop only when the necessary information has been determined for all rooms.

Room logic

Get the width and length of the room in feet and inches.

The smallest unit of measurement is the inch. Therefore, you calculate the number of inches for the width dimension and the number of inches for the length dimension.

Given this, you determine the number of tiles it will take for each dimension. You must take into account the affects of fractional tiles and roundup to determine the number of whole tiles. For example, if the tile size is 12 inches and the room width is 10 feet and 4 inches, the width in inches is 124 inches. Thus the number of tiles in the width direction is 10.333 or 11 tiles.

You do the same for the length dimension. The number of tiles required for the room is simply the number of tiles in the length direction times the number of tiles in the width direction. (Im sure you remember the formula for the area of a rectangle.)

You repeat the above for each room, accumulating the total number of tiles required room by room.

End of main loop.

You now know the total number of tiles required and you must now determine the number of boxes of tiles required. You are given that there are 20 tiles per box. You can not have a fractional number of boxes. Once you determine the number of boxes, the extra tiles should be very easy to calculate.

Hints for rounding up using integer arithmetic.

Suppose the length is len, tile size is tileSize and number of tiles is numTiles and all are type int and in inches. Then:

numTiles = len / tileSize ;

if(( len % tileSize ) > 0)

numTiles = numTiles + 1 ;

You're working for a company that lays ceramic floor tile, and its employees need a program that estimates the number of boxes of tile for a job. A job is estimated by taking the dimensions of each room in feet and inches, and converting these dimensions into a multiple of the tile size rounding up any partial multiple) before multiplying to get the number of tiles for the room. A box contains 20 tiles, so the total number needed should be divided by 20 and rounded up to get the number of boxes. The tiles are assumed to be square. The program should initally prmpt the user for the size of the tie n inches and the number of rooms to be covered with tile. It should then input the dimensions for each room and output the number of tiles needed for that room. After data for the last room is input, the program should output the total number of tiles needed, the number of boxes of tile needed, and how many extra tiles will be left over. Here is an example of how a run might appear: Enter number of rooms: 2 Enter size of tile in inches: 12 Enter room width (feet and 1nches, separated by a space): 17 4 Enter room length (feet and inches, separated by a space): 9 3 Room requires 180 tiles. Enter room width (feet and inches, separated by a space) 11 6 Enter room length (feet and inches, separated by a space): 11 9 Room requires 144 tiles. Total tiles required 1s 324 Number of boxes needed is 17. There Will be 16 extra tiles

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Does it have a clear, engaging lead?

Answered: 1 week ago