Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PaintCoverage.java 1-import java.util.Scanner; 3 public class PaintCoverage 4-{ 6- 1234567890123 public static void main(String[] args) { // Create Scanner object // Create a final

 

PaintCoverage.java 1-import java.util.Scanner; 3 public class PaintCoverage 4-{ 6- 1234567890123 public static void main(String[] args) { // Create Scanner object // Create a final double for how many // square feet 1 gallon of paint will cover // Ask for the square feet needed to cover // Ask how many gallons of paint were purchased 10 11 12 13 14 15 16 // Print whether the user has enough gallons 17 18 // If they don't, print how many more they need 19 20 21 22 } 23 } 24 // Use Math.ceil(number) to round up the number of // gallons you need Write a program that computes if the user has enough paint to cover the area they want painted. One gallon of paint can cover 80 square feet. Ask the user how many square feet they need to paint. Ask how many gallons of paint they already have. Then print if they have enough paint. If they do, print You have enough paint. If they don't, print how many more gallons of paint they will need. Use Math,ceil to round up the number of gallons you will need. For example, if you need 2.5 gallons of paint, you would need to buy 3 gallons at the store. To compute this, use double result - Math.ceil(numGallons); Some example outputs are shown below. Output: User has enough paint How many square feet do you need to paint? 260 How many gallons of paint do you have? 4 You have enough paint Output: User does not have enough paint How many square feet do you need to paint? 460 How many gallons of paint do you have Activate Windows 2 You need 4.0 more gallons Go to Settings to activate

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Programming With Java A Problem Solving Approach

Authors: John Dean

3rd International Edition

1260575241, 9781260575248

More Books

Students also viewed these Programming questions

Question

Based on what you have learned so far, what is a Java interface?

Answered: 1 week ago

Question

Write the shortest Java statement that increments count by 1.

Answered: 1 week ago