Question: Instructions 4 8 Write a program that declares a constant named QUARTS_IN_GALLON which holds the number of quarts in a gallon (4). Also declare a

 Instructions 4 8 Write a program that declares a constant named

Instructions 4 8 Write a program that declares a constant named QUARTS_IN_GALLON which holds the number of quarts in a gallon (4). Also declare a variable named quartsNeeded to represent the number of quarts needed for a painting job, and assign an appropriate value. Compute and display the number of gallons and quarts needed for the job. Display explanatory text with the values- for example. A job that needs 18 quarts requires 4 gallons plus 2 quarts QuartsToGallons.java + 17/ Quarts Togallons.java 2 class QuartsToGallons { 3 // Declare variables final int QUARTS_IN_GALLON = 4; 5 int quartsNeeded = 18; 6 int gallonsNeeded; 7 int extraQuartsNeeded; 9 W Calculate the Gallons required 10 gallons Needed - quartsNeeded/ QUARTS_IN_GALLON; 11 // Calculate the extra Quarts Required 12 extraquartsNeeded = quartsNeeded QUARTS_IN_GALLON; 13 Print Output System.out.println("A job that needs" + quartsNeeded + " quarts requires " + gallons Needed + gallons plus " + extraQuartsNeeded + " quarts."); 16 17 18 25 When submitting the program for testing/grading assign the value 18 to quarts Needed Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre- MacBook Air 80 a do DU 8 % 3 4 5 6 7 8 9 E R T Y 11

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!