My name is Leonard Norwood Jr.
If anyone knows a program that will estimate the number of boxes of tile needed for a job. A job is estimated by taking the dimensions of each room in feet and inches and converting these 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 should have 20 tiles, so I need to divide the total number needed by 20 and rounded up to get the number of boxes (they are square). Here is what I have so far:
#include <iostream>
using namespace std;
int TilesPerRoom(int roomWF, int roomWI, int Tsize,int &roomW,int &roomWR, int &RroomW, int roomLF, int roomLI, int &roomL, int &roomLR, int &RroomL, int &TilesR);
void TotalBox(int Ttiles, int &Tbox, int &TboxR);
int roomWF;
int roomWI;
int roomLF;
int roomLI;
int Tsize;
int TilesR;
int roomW;
int roomWR;
int RroomW;
int roomL;
int roomLR;
int RroomL;
int Trooms;
int Tbox;
int TboxR;
int Ttiles = 0;
int main()
{
while(Trooms < 1)
{
cout << "Enter the number of rooms tiles are needed:";
cin >> Trooms;
if (Trooms < 1)
cout << "Please re-enter a positive value of 1 or greater." << endl;
}
while (Trooms >= 1)
{
Tsize = -1;
while (Tsize <= 0)
{
cout << "Enter the size of tile, in inches.";
cin >> Tsize;
if (Tsize <= 0)
cout << "Please re-enter the positive value greater than 0." << endl;
}
roomWF = -1;
roomWI = -1;
while ((roomWF <= 0) && (roomWI <= 0))
{
cout << "Enter room width (feet and inches, separated by a space):";
cin >> roomWF >> roomWI;
if (((roomWF <= 0) && (roomWI <= 0)))
cout << "Please re-enter positive values greater than 0." << endl;
}
roomLF = -1;
roomLI = -1;
while ((roomLF <= 0) && (roomLI <= 0))
{
cout << "Enter room length (in feet and inches, separated by space):";
cin >> roomLF >> roomLI;
if ((roomLF <= 0) && (roomLI <= 0))
cout << "Please re-enter positive values greater than 0." << endl;
}
cout << " This room requires " << TilesR << " tiles" << endl;
Trooms--;
Ttiles = TilesR + Ttiles;
}
cout << "The total amount of tiles required for the rooms(s) is " << Ttiles << endl;
TotalBox(Ttiles, Tbox, TboxR);
cout << "You will need " << Tbox << "boxes for the job." << endl;
cout << "There will be " << TboxR << "extra tiles." << endl;
char exit_char;
cout <<"\nPress any key and <enter> to exit\n";
cin >> exit_char;
system("pause");
return 0;
}
int TilesPerRoom(int roomWF, int roomWI, int Tsize,int &roomW,int &roomWR, int &RroomW, int roomLF, int roomLI, int &roomL, int &roomLR, int &RroomL, int &TilesR)
{
roomW = ((roomWF * 12) + roomWI);
roomWR = roomW % Tsize;
RroomW = roomW / Tsize;
{
if (roomWR != 0)
RroomW++;
}
roomL = ((roomLF * 12) + roomLI);
roomLR = roomL % Tsize;
RroomL = roomL / Tsize;
{
if (roomLR != 0)
RroomL++;
}
roomW = RroomW * Tsize;
roomL = RroomL * Tsize;
TilesR = ((roomW * roomL)/(Tsize * Tsize));
return TilesR;
}
void TotalBox(int Ttiles, int &Tbox, int &TboxR)
{
TboxR = (Ttiles % 20);
Tbox = (Ttiles / 20);
{
if (TboxR != 0)
Tbox++;
}
}
And it is certainly supposed to run like this.
Enter number of rooms : 2
Enter size of tile in inches: 12
Enter room width (feet and inches, separated by a space); 17 4
Enter room length (same as above): 9 3
Room requires 180 tiles
Enter room width (same as above): 11 6
Enter room length (same as above) 11 9
Room requires 144 tiles
Total titles required is 324
Number of boxes needed is 17.
There will be 16 extra tiles.
This program is only done with functions only, I haven't even learned enum, struct, or all that stuff yet. I'm still not getting it right and I already have the calculations right there, but somethings off.