#include<iostream> using namespace std; void PrintPurpose(); void PrintResults(
ID: 3617487 • Letter: #
Question
#include<iostream>
using namespace std;
void PrintPurpose();
void PrintResults( int, int, int);
void GetRoomDimension(int&, int&, int&, int&);
int ComputeNumberOfTiles(int, int,int, int, int);
int GetNumberOfRoom();
int GetTilesSize();
int main()
{
void PrintPurpose()
{
cout<<"The program computes the number of tiles,the number of boxes of tile for a job"<<endl;
int count,rooms,tileSize, wFt, wIn, lFt, lIn, TotTiles,roomTiles;
count=0;
while(count< rooms)
{
GetRoomDimension(wFt, wIn, lFt, lIn);
{
roomTiles= ComputeNumberOfTiles(wFt, wIn, lFt, lIn,tileSize);
TotTiles+ = roomTiles;
cout<< "Room requires "<< roomTiles<<endl;
count++;
}
PrintResults(numTiles, numBoxes, extra);
{
int boxes,extra;
cout<<"Total tiles required is"<<TotTiles<< endl;
boxes= TotTiles / 20;
if(TotTiles % 20!= 0)
boxes++;
cout<<"Number of boxes needed is"<<boxes<< endl;
cout<<"There will be"<<boxes*20-TotTiles<<"extra tiles. ";
}
//cumpute the number of tiles needed for a room.
int ComputeNumberOfTiles(int widthft, int widthin, int lengthft,int lenghtin, int tileSize)
{
int length, width, roomarea, need, tilearea,tile;
double needed;
roomarea= length*width;
tilearea= tile*tile;
need= roomarea/tilearea;
if(need!= needed)
need++;
return need;
}
//prompts and reads the length and width of a room. checks forinvalid input.
void GetRoomDimension(int& wft, int& win, int& lft,int& lin)
{
cout<<"Enter room width(feet and inches, separated by aspace): ";
cin>>wft>> win;
if(wft<= 0 || win< 0 ||win >12)
{
cout<<"invalid entry ";
cout<<"Enter room width(feet and inches,separated by a space): ";
cin>> wft>> win;
}
cout<<"Enter room lengh(feet and inches, separated by aspace): ";
cin>> lft>> lin;
if(lft<= 0 || lin< 0 || lin> 12)
{
cout<<"Invalid entry ";
cout<<"Enter room length(feet and inches,separated by a space): ";
cin>> lft>> lin;
}
//prompts and reads, and returns the number of rooms. checksfor invalid input.
int GetNumberOfRooms()
cout<<"Enter number of rooms: ";
cin>> rooms;
while(rooms<= 0)
{
cout<<"Invalid entry must be >0 ";
cout<<"Enter number of rooms: ";
cin>> rooms;
}
//prompts and reads and returns the size of tile. checks forinvalid input.
int GetTilesize()
cout<<"Enter size of tile in inches: ";
cin>> tile;
while(tile<= 0)
{
cout<<"invalid entry must be > 0 ";
cout<<"Enter size of tile: ";
cin>> tile;
}
}
Explanation / Answer
please rate - thanks #include using namespace std; void PrintPurpose(); void PrintResults( int, int, int); void GetRoomDimension(int&, int&, int&, int&); int ComputeNumberOfTiles(int, int,int, int, int); int GetNumberOfRooms(); int GetTileSize(); int main() { PrintPurpose(); int count,rooms,tileSize, wFt, wIn, lFt, lIn, TotTiles,roomTiles,numBoxes; int boxes,extra; count=0; rooms=GetNumberOfRooms(); while(countRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.