CMIS 102 Design and write a program that calculates the amount of roofing materi
ID: 654206 • Letter: C
Question
CMIS 102
Design and write a program that calculates the amount of roofing material (in square feet) that a roofer will need to roof each of 50 houses. Assume that each house has asimple pitched roof with a front side and back side and that each roof side is the same and rectangular. The user should be prompted for the Length and Width of one roof side for each house.
Calculate and Display the total amount of roofing material (in square feet) needed to roof each house and gutters(front and back) material needed for each house (assume you have an additional 40 ft for the downspots).
Calculate and Display the total amount of roofing material (in square feet) needed to roof all the houses and gutter material needed for the houses. (assume you have an additional 40 ft for the downspots for each house).
Your program should be flexible enough to handle 1 to 50 houses. You must use at least two functions or subprograms (more would be better) and one loop.
Pseudocode- Provide pseudocode of your overall design that fulfills the requirements of the project. CMIS102 Psuedocode.
Example application test data:
Test Case #
Input
Expected Output
1
Roof 1: length=40, width=15
Roof 2: length=50, width=15
Roof 3: length=60, width=18
Roof 4: length=70, width=18
Roof 1 Area: 1200 sq ft
Gutters: 100 ft
Roof 2 Area: 1500 sq ft
Gutters: 120 ft
Roof 3 Area: 2160 sq ft
Gutters: 140 ft
Roof 4 Area: 2520 sq ft
Gutters: 160 ft
Total Area: 7380 sq ft
Total Gutter Length: 520 ft
2
Your input data
Your expected output
3
Your input data
Your expected output
Test Case #
Input
Expected Output
1
Roof 1: length=40, width=15
Roof 2: length=50, width=15
Roof 3: length=60, width=18
Roof 4: length=70, width=18
Roof 1 Area: 1200 sq ft
Gutters: 100 ft
Roof 2 Area: 1500 sq ft
Gutters: 120 ft
Roof 3 Area: 2160 sq ft
Gutters: 140 ft
Roof 4 Area: 2520 sq ft
Gutters: 160 ft
Total Area: 7380 sq ft
Total Gutter Length: 520 ft
2
Your input data
Your expected output
3
Your input data
Your expected output
Explanation / Answer
#include<iostream.h>
#include<conio.h>
class a
{
public:
int l,w;
void area()
{
int i,r[50],l,w,g,a,tota=0,totg=0,n;
cout<<"Enter total Houses";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter lenght for house "<<i+1;
cin>>l;
cout<<"Enter width for house "<<i+1;
cin>>w;
cal(l,w);
}
void cal(int i, int w)
{
int a=0,g=0,tota=0,totg=0;
a=l*w*2;
g=l*l+20;
cout<<"Total Roof area is "<<a;
cout<<"Total Gutter is "<<g;
tota=tota+a;
totg=totg+g;
cout<<"Total Roof area is "<<tota;
cout<<"Total Gutter area is "<<tot;
}
};
void main()
{
a o;
o.area();
}