Answer to Question #303762 in C++ for core

Question #303762

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.



1
Expert's answer
2022-02-28T13:53:46-0500
#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;
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog