Write a C++ program to calculate the cost to paint a wall. Logistics: Prompt the user to enter the wall height and the wall width. Also prompt for the price of one can of paint. Calculate and output the wall's area to one decimal place. Then calculate and output the amount of paint needed to three decimal places. One gallon of paint covers 350 square feet. Calculate and output the number of 1 gallon cans needed to paint the wall. Extra paint may be left over. Hint: Use ceil(), included in math.h, to round up to the nearest gallon and convert to an integer. Calculate and output the paint cost, sales tax of 7%, and total cost. Dollar values are output with two decimal places.
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Write a C++
Logistics:
- Prompt the user to enter the wall height and the wall width. Also prompt for the price of one can of paint.
- Calculate and output the wall's area to one decimal place.
- Then calculate and output the amount of paint needed to three decimal places. One gallon of paint covers 350 square feet.
- Calculate and output the number of 1 gallon cans needed to paint the wall. Extra paint may be left over. Hint: Use ceil(), included in math.h, to round up to the nearest gallon and convert to an integer.
- Calculate and output the paint cost, sales tax of 7%, and total cost. Dollar values are output with two decimal places.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images