Hi, this is the code I have currently and I have the surface area of the entire cabin, but I need to ask the user what is the dimensions of a kitchen counter and a shower stall and then subtract that from my surface area. How would I go upon doing that?
this is very important as well(Verify that these dimensions are realistic by confirming that the combined floor space of the counter and the shower stall do not take up more than 20% of the cabin's total floor space and that the shower stall is no larger than 32 inches x 60 inches.)
Here are the instructions for this program
The cabin is still a simple rectangular structure so, as before, you’ll need to request the dimensions of the cabin, but now you'll also need to request the dimensions of the kitchen counter and the shower stall. Now, you’ll call two separate functions to calculate most of the details. We want to know the total wall and ceiling surface area, how much paint and paint brushes will be needed, and how many boxes of floor tiles to buy.
Use the following functions, by name, in your design for this program:
main: do all input and output in main.
calc_area: Calculate the surface area of a rectangle and return the answer to main. Call this function several times: once for each wall, again for the ceiling, the floor, the kitchen counter and, finally, the shower stall.
calc_tiles: Calculate the number of boxes of tiles that will be needed to cover the floor. Of course, you'll need to subtract the space taken up by the kitchen counter and shower stall first. Tiles are sized 12 inches x 12 inches and there are 15 tiles in a box.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <string>
using namespace std;
double calc_area(double s1, double s2);
int main()
{
double height, width, length, surf_area
cout << "What is the length, width, and height of the cabin?";
cin << length << width << height;
surf_area = calc_area(h, l); //front wall
(height and length);
surf_area += calc_area(h, w); //side wall
(height and width);
surf_area += calc_area(h, l); // back wall
(height and length);
surf area += calc_area(h, w); // side wall 2
(height and width);
surf_area += calc_area(l, w); // ceiling
(length and width);
surf_area += calc_area(l, w); // floor
cout << "the total surface area is " << surf_area;
return 0;
}
double calc_area(double side1, double side2)
{
return side1 * side2;
}
|