Question
please explain in C++ only
This program determines how much it cost to paint a room Please write a program which determines and prints out three results
Execution 2: Please enter the width of the room in feet: 142 Please enter the length of the room in feet: 174 Please enter th
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Source Code::

#include <bits/stdc++.h>    //header file for ceil
using namespace std;

int main() {
   // your code goes here
   double length,width,height;
   //taking inputs from user
   cout<<"Please enter the width of the room in feet: ";
   cin>>width;
   cout<<"Please enter the length of the room in feet: ";
   cin>>length;
   cout<<"Please enter the height of the room in feet: ";
   cin>>height;
   //total_area for find total wall_area+ceil_area
   //wall_area will compute 2 wall(length,height) and 2 wall(width,length)
   //ceil_area will compute ceiling area(length,width)
   double total_area,wall_area,ceil_area;
   wall_area= 2*length*height+2*height*width;
   ceil_area=width*length;
   total_area=wall_area+ceil_area;
  
   //total_gallon is equals to total_area per 400 sq. feet
   double total_gallon=total_area/400.0;
   //total_cost is equals to ceil(total_gallon)*30 and we will subtract discount later
   double total_cost=ceil(total_gallon)*30;
  
   //subtracting discount
   // if total gallons are greater than 5 then 20% discount
   if(ceil(total_gallon)>=5){
        total_cost-=0.2*total_cost;
   }
   else if(ceil(total_gallon)>=3) // if total gallons are greater than 3 then 10% discount
   {
        total_cost-=0.1*total_cost;
   }
   cout<<"You need exactly "<<total_gallon<<" gallon(s) of paint so you need to buy "<<ceil(total_gallon)<<" gallon(s) which cost $"<<total_cost<<" dollers.";
   return 0;
}


Output::

Please enter the width of the room in feet: 8 Please enter the length of the room in feet: 8 Please enter the height of the r

Please enter the width of the room in feet: 14.2, Please enter the length of the room in feet: 17.4 Please enter the height o

Please enter the width of the room in feet: 25.3, Please enter the length of the room in feet: 30.6 Please enter the height o

Add a comment
Know the answer?
Add Answer to:
please explain in C++ only This program determines how much it cost to paint a room...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in python please (1) Prompt the user to input a wall's height and width. Calculate and...

    in python please (1) Prompt the user to input a wall's height and width. Calculate and output the wall's area (integer). (Submit for 2 points). Enter wall height (feet): 12 Enter wall width (feet): 15 Wall area: 180 square feet (2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall (floating point). Assume a gallon of paint covers 350 square feet. Store this value in a variable. Output the amount of paint...

  • CENGAGE MINDTAP gramming Exercise 3-8 PaintCalculator.java Instructions Assume that a gallon of paint covers about 350...

    CENGAGE MINDTAP gramming Exercise 3-8 PaintCalculator.java Instructions Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompts the user for the length, width, and height of a rectangular room. Pass these three values to a method that does the following: 1 import java.util.Scanner; 2 public class PaintCalculator { 3 public static void main(String args[]) { // Write your code here public static double computeArea double length, double...

  • C++, please make it as simple as possible. A Paint Company is hiring you to develop...

    C++, please make it as simple as possible. A Paint Company is hiring you to develop an application to estimate the costs for a job. They have determined that for every 120 square feet of wall area, one gallon of paint and eight hours of labor is required. The company charges US$ 18.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted and the price of...

  • CHALLENGE ACTIVITY 3.2.1: Gallons of paint needed to paint walls. Finish the program to compute how...

    CHALLENGE ACTIVITY 3.2.1: Gallons of paint needed to paint walls. Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can cover 350.0 square feet. So gallons = the square feet divided by 350,0. If the input is 250.0, the output should be: 0.714285714286 1 gallons_paint - 0.0 3 wall_area - float(input ) S # Assign gallons_paint below 7 Your solution goes here 9 print(gallons paint)

  • I need to write a paint job estimator program in python. I have most of it...

    I need to write a paint job estimator program in python. I have most of it down but i keep getting errors and I dont know how to fix it or what im doing worng specs: A painting company has determined that for every 350 square feet of wall space, one gallon of paint and six hours of labor are required. The company charges $62.25 per hour for labor. Write a program call paintjobestimator.py that asks the user to enter...

  • This exercise requires designing a program which solves the problem described in the problem statement below....

    This exercise requires designing a program which solves the problem described in the problem statement below. Provide comments as necessary in your pseudo-code and the Java program. Your solution must include these components: Flowchart Pseudo-code Hierarchy Chart Program Coded Program Output Problem Statement A painting company has determined that to paint 115 square feet of wall space, the task will require one gallon of paint and 8 hours of labor. The company charges $20.00 per hour for labor. Design a...

  • (1) Prompt the user to input a wall's height and width. Calculate and output the wall's...

    (1) Prompt the user to input a wall's height and width. Calculate and output the wall's area. (Submit for 2 points). Enter wall height (feet): 12 Enter wall width (feet): 15 Wall area: 180 square feet (2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet. Store this value using a const double variable. (Submit for 2 points, so 4 points total). Enter...

  • A painting company has determined that for every 110 square feet of wall space, one gallon...

    A painting company has determined that for every 110 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $25.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted (different colors) and the price of the paint per gallon. It should also ask for the square feet of wall space in each room. Rooms and gallons...

  • Specifications: • Prompt the user to input a wall's height and width. Calculate and output the...

    Specifications: • Prompt the user to input a wall's height and width. Calculate and output the wall's area. • Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet Store this value using a const double variable. • Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to...

  • Help C++ Design a program for determining how much a fence will cost based on the...

    Help C++ Design a program for determining how much a fence will cost based on the size of a residents back yard. Luckily, every resident has a square backyard with side lengths of at least 6 feet. Unfortunately, there is a local zoning requirement that all fences must be exactly 2 feet inside the perimeter of a backyard. The local fence construction company will charge 10 dollars per foot of fence. Based on the description above design a program that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT