9Paint Calculator

Sometimes you have to round up to the next number rather than follow standard rounding rules.

Calculate gallons of paint needed to paint the ceiling of a room. Prompt for the length and width, and assume one gallon covers 350 square feet. Display the number of gallons needed to paint the ceiling as a whole number.

Example Output

 
You will need to purchase 2 gallons of
 
paint to cover 360 square feet.

Remember, you can’t buy a partial gallon of paint. You must round up to the next whole gallon.

Constraints

  • Use a constant to hold the conversion rate.

  • Ensure that you round up to the next whole number.

Challenges

  • Revise the program to ensure that inputs are entered as numeric values. Don’t allow the user to proceed if the value entered ...

Get Exercises for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.