Create a program to estimate the number of boxes of tile tha

Create a program to estimate the number of boxes of tile that are needed to complete a job of tiling some number of rooms For full credit, you should define and use at least two functions include some basic input error handling as noted below Parameters of the problem All rooms will use the same tile, and all tiles are square. You must account for the number of whole tiles needed (without attempting to determine if a tile can be split to fit extra space). This means that you cannot just calculate the area of a room and divide by the size of a tile. You will need to round up for partial tiles - look at the ceil function. Your program should input the number of rooms the length and width of each room in whole feet and inches the size of the tile in inches the number of tiles in a box Your program should output the number of tiles and number of boxes per room the number of tiles and number of boxes overall the number of tiles that will be left over Your program should also provide some basic error checking make sure that negative values are not entered for feet or inches make sure that values entered for inches are less than 12 make sure that tile and box sizes are reasonable values

Solution

#include<iostream>
#include<cmath>
#define MAX 10
using namespace std;

int main()
{
   int feet, inches,no_rooms, size_tile_inches, no_tiles_box, count = 0,no_of_boxes ;
   int area_room[MAX];
   double tiles_required_per_room[MAX];
   int total_tiles = 0;
   cout << \"Enter the number of rooms: \";
   cin >> no_rooms;
   cout << \"Enter number of tiles in a box: \";
   cin >> no_tiles_box;
   cout << \"Enter the size of tile in inches: \";
   cin >> size_tile_inches;
  
   while(count < no_rooms)
   {
       cout << \"\ Length and width of room no\"<<count+1<<\" in feet and inches separated by space: \";
       cin >> feet >> inches;
       if (inches > 12)
       {
           cout << \"Inches cannot be greater than 12 , please try again\";
           continue;
       }
       if (inches < 0 || feet < 0)
       {
           cout << \"Feet or inches cannot be negetive, please try again\" << endl;
           continue;
       }
       //calculate area of each room
       area_room[count] = feet * 12 + inches;
       /*tiles required can be calculated as area of the room divided by area of square tile, here length and breadth given in feet and inches ,
       *so convert it to lower conversion ie everything ti incges by multiplying feet with 12*/
       tiles_required_per_room[count] = ceil(area_room[count] / (size_tile_inches*size_tile_inches));
       cout << \"Number of tiles required for room\" << count + 1 << \" : \";
       cout << tiles_required_per_room[count];
       total_tiles += tiles_required_per_room[count];
       count++;

   }
   cout << \"\ No of boxes required are : \";
   //no of boxes can be calculated as follows: dividing total_tiles by no of tiles in boxes
   no_of_boxes = total_tiles / no_tiles_box;
   int rem = total_tiles % no_tiles_box;
  
   if (rem == 0 )
   {
       cout << no_of_boxes ;
   }
   else
   {
       cout << no_of_boxes+1<< \" and remaining tiles in boxes are : \" << no_tiles_box - rem << endl;
   }

  

}

------------------------------------------------------------------------------------------------------------------------

//output

Enter the number of rooms: 3
Enter number of tiles in a box: 10
Enter the size of tile in inches: 8

Length and width of room no1 in feet and inches separated by space: 12 10
Number of tiles required for room1 : 2
Length and width of room no2 in feet and inches separated by space: 14 15
Inches cannot be greater than 12 , please try again
Length and width of room no2 in feet and inches separated by space: 14 12
Number of tiles required for room2 : 2
Length and width of room no3 in feet and inches separated by space: 13 9
Number of tiles required for room3 : 2
No of boxes required are : 1 and remaining tiles in boxes are : 4

 Create a program to estimate the number of boxes of tile that are needed to complete a job of tiling some number of rooms For full credit, you should define an
 Create a program to estimate the number of boxes of tile that are needed to complete a job of tiling some number of rooms For full credit, you should define an

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site