Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Output Test Cases Check Code Expand All Expected result: Test Testing having too much paint Your result: Difference: Expected result: Test Cases Your result:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Output Test Cases Check Code Expand All Expected result: Test Testing having too much paint Your result: Difference: Expected result: Test Cases Your result: Difference: Expected result: Docs Minimize All Testing have exactly enough paint Pass X How many square feet do you need to paint? How many gallons of paint do you have? You have enough paint Assignment Testing not enough paint How many square feet do you need to paint? How many gallons of paint do you have? Not Enough Paint Gallons of paint required to cover the remaining area is:700.0 Gallons Message Check what you're supposed to print How many square feet do you need to paint? How many gallons of paint do you have? YNot Enough hPaint Gallons of paint required to cover the remainouingh parea is:700.0 Gallonts Grade How many square feet do you need to paint? How many gallons of paint do you have? You have enough paint X Check what you're supposed to print How many square feet do you need to paint? How many gallons of paint do you have? Not Enough Paint Gallons of paint required to cover the remaining area is:2100.0 Gallons X How many square feet do you need to paint? How many gallons of paint do you have? YNot Enough hPaint Gallons of paint required to cover the remainouingh parea is: 2100.0 Gallonts How many square feet do you need to paint? How many gallons of paint do you have? More You should not print "You have enough paint" Difference: Expected result: Your result: Testing not enough paint Difference: Testing not Expected result: Your result: Gallons of paint required to cover the remaining area is:210e.e Gallons Difference: How many square feet do you need to paint? How many gallons of paint do you have? YNot Enough hPaint Gallons of paint required to cover the remainouingh parea is:2100. Gallonts X You should not print "You have enough paint" How many square feet do you need to paint? How many gallons of paint do you have? You need 1.0 more gallons How many square feet do you need to paint? How many gallons of paint do you have? Not Enough Paint Gallons of paint required to cover the remaining area is:2900.0 Gallons How many square feet do you need to paint? How many gallons of paint do you have? YNot Enough Paint Gallons of paint required 1.0to mcover the remaining area is:2900.0 Gallons X You should print "5.0 more gallon" enough paint How many square feet do you need to paint? How many gallons of paint do you have? You need 5.0 more gallons How many square feet do you need to paint? How many gallons of paint do you have? Not Enough Paint Gallons of paint required to cover the remaining area is: 4800.0 Gallons How many square feet do you need to paint? How many gallons of paint do you have? YNot Enough Paint Gallons of paint required 5.0to mcover the remaining area is: 4800.0 Gallons 4 New + PaintCoverage.java 16.1.2 Lesson 3.2 Constructions 1 import java.util.Scanner; 2 3 class PaintCoverage 4- { 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ~ 24 25 26 27 28 29 0 123458 39 40 41 30 33 36 37 41} public static void main(String[] args) { // Create Scanner object Scanner myObj double paintpurchased, sqfttocover; // Create a final double for how many // square feet 1 gallon of paint will cover final double paintcover = 10; // Ask for the square feet needed to cover System.out.println ("How many square feet do you need to paint? "); sqfttocover myObj.nextDouble(); // Ask how many gallons of paint were purchased System.out.println("How many gallons of paint do you have? "); paintpurchased = myObj.nextDouble(); // Print whether the user has enough gallons new Scanner(System.in); // If they don't, print how many more they need // Use Math.ceil(number) to round up the number of // gallons you need //in if( (paintpurchased - paintcover) >= sqfttocover) System.out.println("You have enough paint"); else { } Submit + Continue Save System.out.println("Not Enough Paint"); double pendingsqft = sqfttocover - (paintpurchased * paintcover); double paintrequired = Math.ceil(pendingsqft * paintcover); System.out.println("Gallons of paint required to cover the remaining area is:" + paintrequired +" Gall New + PaintCoverage.java 16.1.2 Lesson 3.2 Constructions 1 import java.util.Scanner; 2 public class PaintCoverage 3 4 { 5 6+ 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 // Print whether the user has enough gallons // If they don't, print how many more they need // Use Math.ceil(number) to round up the number of // gallons you need Submit + Continue Save 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? 2 You need 4.0 more gallons

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

Accounting Information Systems

Authors: George H. Bodnar, William S. Hopwood

11th Edition

0132871939, 978-0132871938

More Books

Students also viewed these Programming questions