Variables – Painting a wall
// WallPainting.cpp : Defines the entry point for the console application.
//
include
include
using namespace std;
int main() {
double width = 0.0;
double height = 0.0;
double area = 0.0;
const double sqFeetPerGal = 350;
// Get width as user input
cout << "Enter the width of the wall in feet: ";
cin >> width;
// Get height as user input
cout << "Enter the height of the wall in feet: ";
cin >> height;
// Calculate and output area of wall
area = (width * height);
cout << "Total area to paint in square feet: "
<< area << "\n";
//Calculate number of gallons of paint
int paintNeeded = ceil(area / sqFeetPerGal);
cout << "Total number of gallons of paint needed: "
<< paintNeeded << "\n";
//Calculate total cost of paint
double costOfPaint = paintNeeded * 27;
cout << "Total cost of paint in dollars is: $"
<< costOfPaint << "\n";
//Calculate time to paint
double timeToPaint = (area / 100);
cout << "Total time to paint in hours: "
<< timeToPaint << "\n";
system("pause");
return 0;
}
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
