Question

In: Computer Science

Write a program that determines the cost of painting the walls of a windowless room. There...

Write a program that determines the cost of painting the walls of a windowless room. There is one door and it will be painted the same color as the walls. The problem requires a main function and two custom functions that are imported from a custom module that you create. In main, the program should prompt the user for five inputs shown in blue in the Sample Output below:

  • the length, width, and height of the room in feet.
  • the cost of one quart of the chosen paint.
  • the square feet that can be covered by one quart of paint.

The three dimensions of the room should then be used as arguments for a function that calculates and returns the area of the walls in square feet. This area and the remaining two inputs should be used as arguments for a second, void function that determines and prints the cost of the painting job. There will likely be paint left over. There is a method in the math module that you can use to "round up" the number of quarts needed.
Sample Output
Enter the length of the room in feet 20
Enter the width of the room in feet 16
Enter the height of the walls in feet 9
Enter the price of one pail of paint 24.99
Enter the sq ft covered by one pail 100
This job requires 7 pails of paint
The cost of paint is $174.93

Solutions

Expert Solution

atleast mention which programming language

#include<bits/stdc++.h>
using namespace std;
void print_area(double ar , double cost , double c){
cout<<"This job requires "<<ceil((ar/c))<<" pails of paint"<<"\n";
cout<<"The cost of paint is "<<(cost*(ceil(ar/c)));
}
double calculate_area(double l , double b, double h){
   double res;
   res=(l*h+b*h);
   res=(double)2*res;
   return res;
}
int main(){
   double l , b, h , cost, c;
   cout<<"ENTER THE LENGTH\n";
   cin>>l;
   cout<<"ENTER THE BREADTH\n";
   cin>>b;
   cout<<"ENTER THE HEIGHT\n";
   cin>>h;
   cout<<"Enter the price of one pail of paint\n";
   cin>>cost;
   cout<<"Enter the sq ft covered by one pail\n";
   cin>>c;
   double ar=calculate_area(l , b, h);
   print_area(ar , cost , c);
}


Related Solutions

Write a program in PYTHON that determines the cost of painting the walls of a windowless...
Write a program in PYTHON that determines the cost of painting the walls of a windowless room. There is one door and it will be painted the same color as the walls. The problem requires a main function and two custom functions that are imported from a custom module that you create. In main, the program should prompt the user for five inputs shown in blue in the Sample Output below: the length, width, and height of the room in feet. the...
1. A living room is 15 ft x 19 ft. The walls of the room are...
1. A living room is 15 ft x 19 ft. The walls of the room are 8.5 ft tall. Calculate the total area of the West wall? How many rolls of wallpaper will you need to cover the wall. One roll will cover 44 square feet What will be the cost of the wallpaper? ($14.99 for a pack of 2 rolls) 2. Calculate the following for the remaining walls Calculate the total area of the North Wall. (Note: You are...
Write a java program using the following instructions: Write a program that determines election results. Create...
Write a java program using the following instructions: Write a program that determines election results. Create two parallel arrays to store the last names of five candidates in a local election and the votes received by each candidate. Prompt the user to input these values. The program should output each candidates name, the votes received by that candidate, the percentage of the total votes received by the candidate, and the total votes cast. Your program should also output the winner...
PYTHON PROGRAM: Write a program that determines the day of the week for any given calendar...
PYTHON PROGRAM: Write a program that determines the day of the week for any given calendar date after January 1, 1900, which was a Monday. This program will need to account for leap years, which occur in every year that is divisible by 4, except for years that are divisible by 100 but are not divisible by 400. For example, 1900 was not a leap year, but 2000 was a leap year.
Write a program that determines a student’s grade. The program will read three types of scores...
Write a program that determines a student’s grade. The program will read three types of scores (quiz, mid-term, and final scores) and determine the grade based on the following rules: -if the average score =90% =>grade=A -if the average score >= 70% and <90% => grade=B -if the average score>=50% and <70% =>grade=C -if the average score<50% =>grade=F Using Switch Statement Need to code to be simple to understand. No pointers should be used
Amy and Bill are fixing up their house by painting walls and installing electrical outlets. In...
Amy and Bill are fixing up their house by painting walls and installing electrical outlets. In one hour, Amy can paint 8 walls, or install 6 outlets. In one hour, Bill can paint 5 walls, or install 5 outlets a. If Amy painted 8 walls in the first hour of work, and then switched to doing 6 outlets in the second hour of work, what was the opportunity cost of each of those outlets? Instructions: Round your answers to two...
Write a program in JAVA that takes in two words, and then it recursively determines if...
Write a program in JAVA that takes in two words, and then it recursively determines if the letters of the first word are contained, in any order, in the second word. If the size of the first word is larger than the second then it should automatically return false. Also if both strings are empty then return true. YOU MAY NOT(!!!!!!!!!!): Use any iterative loops. In other words, no for-loops, no while-loops, no do-while-loops, no for-each loops. Use the string...
Write a program that determines whether an input string is a palindrome; that is, whether it...
Write a program that determines whether an input string is a palindrome; that is, whether it can be read the same way forward and backward. At each point, you can read only one character of the input string; do not use an array to first store this string and then analyze it (except, possibly, in a stack implementation). Consider using multiple stacks. In Pseudocode please
I am trying to write a java program that determines if an inputted year is a...
I am trying to write a java program that determines if an inputted year is a leap year or not, but I am not able to use if else statements how would I do it. I don't need the code just advice.
write a c++ program an expression that determines if an integer, n is a negative four...
write a c++ program an expression that determines if an integer, n is a negative four digit number. write a c++ program an expression that determines if a string, wd, equals "so" ignoring case.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT