Respuesta :
Answer:
#include <cmath>
#include<iostream>
using namespace std;
int main()
{
double height, width;
cout<<"Enter wall height (feet): ";
cin>>height;
cout<<"Enter wall width (feet): ";
cin>>width;
//1
double area;
area = width * height;
cout<<"Wall area: "<<area<<" square feet"<<"\n";
//2
const double gallon = area/350.0;
cout<<"Paint needed: "<<gallon<<" gallons"<<"\n";
//3
cout << "Cans needed :" << round(gallon) << " can(s)";
return 0;
}
Explanation:
This line declares the height and width as double
double height, width;
This line prompts user for height
cout<<"Enter wall height (feet): ";
This line gets user input for height
cin>>height;
This line prompts user for width
cout<<"Enter wall width (feet): ";
This line gets user input for width
cin>>width;
//1 Question 1 begins here
This line declares area as double
double area;
The line calculates area
area = width * height;
The line prints the calculated area
cout<<"Wall area: "<<area<<" square feet"<<"\n";
//2 Question 2 begins here
This line declares and calculates gallon as a constant double variable
const double gallon = area/350.0;
This line prints the calculated gallon
cout<<"Paint needed: "<<gallon<<" gallons"<<"\n";
//3 Question 3 begins here
This line rounds gallon to nearest whole number and prints the result
cout << "Cans needed :" << round(gallon) << " can(s)";