Ask Question
3 January, 15:21

A painting company has determined that for every 115 square feet or wall space, one gallon of paint and eight hours of labor will be required. The company charges $.18.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 methods that return the following: * 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

+5
Answers (1)
  1. 3 January, 16:59
    0
    The program to calculate the total paint cost and other values is given below.

    #include

    using namespace std;

    int main () {

    int rooms, laborChrg = 18;

    float paintChrg;

    float feetPerRoom[rooms];

    float paintReq, laborHrs, paintCost, laborCost, totalCost, totalsqft=0;

    cout<<"Enter the number of rooms to be painted "<
    cin>>rooms;

    for (int i=0; i < = rooms; i++)

    {

    cout<<"Enter the square feet in room "<
    cin>>feetPerRoom[i];

    / / shortcut operator which is equivalent to totalsqft = totalsqft + feetPerRoom[i];

    totalsqft + = feetPerRoom[i];

    }

    cout<<"Enter the cost of the paint per gallon "<
    cin>>paintChrg;

    laborHrs = (totalsqft/115) * 8;

    laborCost = laborHrs * laborChrg;

    paintReq = totalsqft/115;

    paintCost = paintReq * paintChrg;

    totalCost = laborCost + paintCost;

    cout<<"The number of gallons of paint required "<
    cout<<"The hours of labor required "<
    cout<<"The cost of the paint is "<
    cout<<"The labor charges are "<
    cout<<"The Total cost of the paint job is "<
    return 0;

    }

    Explanation:

    The header files for input and output are imported.

    #include

    using namespace std;

    All the variables are taken as float except labour charge per hour and number of rooms.

    The user is asked to input the number of rooms to be painted. An array holds the square feet in each room to be painted.

    cout<<"Enter the number of rooms to be painted "<
    cin>>rooms;

    for (int i=0; i < = rooms; i++)

    {

    cout<<"Enter the square feet in room "<
    cin>>feetPerRoom[i];

    totalsqft + = feetPerRoom[i];

    }

    The above code asks for square feet in each room and calculates the total square feet to be painted simultaneously.

    All the data to be displayed is calculated based on the values of labor charge per hour and gallons of paint needed, given in the question.

    laborHrs = (totalsqft/115) * 8;

    laborCost = laborHrs * laborChrg;

    paintReq = totalsqft/115;

    paintCost = paintReq * paintChrg;

    totalCost = laborCost + paintCost;

    All the calculated values are displayed in the mentioned order.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A painting company has determined that for every 115 square feet or wall space, one gallon of paint and eight hours of labor will be ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers