A painting company has determined that for every 110 square feet of wall space,
ID: 3681185 • Letter: A
Question
A painting company has determined that for every 110 square feet of wall space,
one gallon of paint and eight hours of labor will be required. The company charges
$25.00 per hour for labor. Write a modular program that allows the user to enter
the number of rooms that are to be painted and the price of the paint per gallon. It
should also ask for the square feet of wall space in each room. It should then display
the following data:
• The number of gallons of paint required
• The hours of labor required
• The cost of the paint
• The labor charges
• The total cost of the paint job
Input validation: Do not accept a value less than 1 for the number of rooms. Do not
accept a value less than $10.00 for the price of paint. Do not accept a negative value
for square footage of wall space.
Explanation / Answer
#include <iostream>
#include <cstdlib>
using namespace std;
int fib(int n);
int i;
int main() {
// your code goes here
int r,p,sqfeet[20];
int tsqfeet=0,i=0;
int g;
cout<<"Enter number of rooms:"<<endl;
cin>>r;
if(r>=1){
cout<<"Enter price of gallons:"<<endl;
cin>>p;
if(p>0 && p<10){
cout<<"Enter square feet for each room:"<<endl;
for(i=0;i<r;i++){
cin>>sqfeet[i];
if(sqfeet[i]<0){
cout<<"Square feet of room should not be negative"<<endl;
exit(0);
}
tsqfeet = tsqfeet+sqfeet[i];
}
g = tsqfeet/110;
cout<<"The number of gallons of paint required "<<g<<endl;
cout<<"The hours of labor required "<<g*8<<"hours"<<endl;
cout<<"The cost of the paint "<<g*p<<"$"<<endl;
cout<<"The labor charges "<<(g*8)*25<<"$"<<endl;
cout<<"The total cost of the paint job "<<g*(p+200)<<"$"<<endl;
}
}else{
cout<<"Room Number should not be less then 1"<<endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.