A painting company has determined that for every 115 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges P120.00 per hour for labor. Write a program that allows the user to enter the number of rooms 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. The program should have functions that return 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
Then it should display the data on the screen.
#include <iostream>
int nubmerOfRooms;
int foots[10001];
int totalFoots = 0;
int calcNumberOfGallons(int n) {
return (n + 114) / 115;
}
int requiredHours(int n) {
return 8 * n;
}
double laborCharges(int n) {
return 120.00 * n;
}
int main() {
scanf("%d", &numberOfRooms);
for (int i = 0; i < numberOfRooms; i++) {
scanf("%d", &foots[i]);
totalFoots += foots[i];
}
int n;
printf("%d", (n = calcNumberOfGallons(totalFoots)));
printf("%d", (n = requiredHours(n)));
printf("%f", laborCharges(n));
return 0;
}
Comments
Leave a comment