```
#include <iostream>
using namespace std;
void GetRoomTiles(int WidthFeet, int WidthInches, int &TotalWidth, int LengthFeet, int LengthInches, int &TotalLength, int TileSize, int &RoomTiles);
void GetTotalTiles(int RoomTiles, int &TotalTiles);
void GetNumberOfBoxes(int TotalTiles, int TileBoxes, int &ExtraTiles, int &NumberOfBoxes);
int main()
{
int NumberOfRooms;
int TileSize;
int WidthFeet, WidthInches, TotalWidth;
int LengthFeet, LengthInches, TotalLength;
int RoomTiles, TotalTiles;
int NumberOfBoxes = 0;
int TilesBoxes = 20;
int ExtraTiles = 0;
ExtraTiles++;
cout << "Enter the number of rooms needed for tiles:";
cin >> NumberOfRooms;
if (NumberOfRooms <= 0)
cout << "Please re-enter a positive value greater than 0." << endl;
TileSize = -1;
cout <<"Enter the size of tile in inches.";
cin >> TileSize;
if (TileSize <= 0)
cout << "Please re-enter the positive value greater than 0." << endl;
if (TileSize <= 11)
cout << "Make sure to enter inches greater than 11." << endl;
WidthFeet = -1;
WidthInches = -1;
while((WidthFeet <= 0) && (WidthInches <= 0))
{
cout << "Enter room width (feets and inches, separated by space)" << endl;
cin >> WidthFeet >> WidthInches;
if((WidthFeet <= 0) && (WidthInches <= 0))
cout << "Please re-enter positive values dimensions greater than 0." << endl;
}
LengthFeet = -1;
LengthInches = -1;
while((LengthFeet <= 0) && (LengthInches <= 0))
{
cout << "Enter room length (feets and inches, separated by space)" << endl;
cin >> LengthFeet >> LengthInches;
if((LengthFeet <= 0) && (LengthInches <= 0))
cout << "Please re-enter positive values dimensions greater than 0." << endl;
GetRoomTiles(WidthFeet, WidthInches, TotalWidth, LengthFeet, LengthInches, TotalLength, TileSize, RoomTiles);
GetTotalTiles(RoomTiles, TotalTiles);
}
GetNumberOfBoxes(TotalTiles, TilesBoxes, ExtraTiles, NumberOfBoxes);
system("pause");
return 0;
}
void GetRoomTiles(int WidthFeet, int WidthInches, int &TotalWidth, int LengthFeet, int LengthInches, int &TotalLength, int TileSize, int &RoomTiles)
{
TotalWidth = ((WidthFeet * 12) + WidthInches);
cout << "Total Width in inches is " << TotalWidth << endl;
TotalLength = ((LengthFeet * 12) + LengthInches);
cout << "Total Length in inches is " << TotalLength << endl;
RoomTiles = ((TotalWidth / (TileSize - 1)) * (TotalLength / (TileSize - 1)));
cout << "The room requires: " << RoomTiles << " tiles." << endl;
}
void GetTotalTiles(int RoomTiles, int &TotalTiles)
{
TotalTiles += RoomTiles;
cout << "Total tiles required: " << TotalTiles << endl;
}
void GetNumberOfBoxes(int TotalTiles, int TilesBoxes, int &ExtraTiles, int &NumberOfBoxes)
{
ExtraTiles = TotalTiles / TilesBoxes;
NumberOfBoxes = ((TotalTiles + ExtraTiles) / TilesBoxes);
cout << "The total number of boxes needed is: " << NumberOfBoxes << endl;
cout << "There will be " << ExtraTiles << " extra tiles." << endl;
}
```

Alright guys this is what I've come up. It complied fine. And actually the stuff for the Room Tiles is actually correct, but the Number Of Boxes, Extra Tiles, and Total Tiles. are still off. What am I doing wrong? and how do I fix it?

This is what I'm doing:

Need to estimate 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.

Program should prompt user for size of the tile in 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.

Use functional decomposition to solve this problem and code the solution using functions wherever it makes sense to do so. Your program should check for invalid data such as non-positive dimensions, number of rooms less than one, number of inches greater than 11, and so on. It should prompt the user for corrected input whenever it detects invalid input. Now that your programs are becoming more complex it is even more important for you to use proper indentation and style, meaningful identifiers and appropriate comments.

I know you guys have stuff like this getting on your nerves, but I nearly figured it all out. I just need to know how to completely fix it so I can be happy of what I did to make sure I finished it all correctly.

Sorry for the inconvience, and I'm gonna go delete my previous thread now.