1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
scoundrel [369]
3 years ago
5

// QuartsToGallons.java public class QuartsToGallons { public static final int QUARTS_IN_GALLON = 4; public static void main(Str

ing[] args) { int quartsNeeded = 18; // finding required quarts System.out.println("A job that needs " + quartsNeeded + " quarts requires " + (quartsNeeded / QUARTS_IN_GALLON) + "gallons plus " + (quartsNeeded % QUARTS_IN_GALLON) + "quarts"); } }
Mathematics
1 answer:
sashaice [31]3 years ago
6 0

Program rearranged

// QuartsToGallons.java

public class QuartsToGallons

{

public static final int QUARTS_IN_GALLON = 4;

public static void main(String[] args)

{

int quartsNeeded = 18;

// finding required quarts

System.out.println("A job that needs " + quartsNeeded + " quarts requires " + (quartsNeeded / QUARTS_IN_GALLON) + "gallons plus " + (quartsNeeded % QUARTS_IN_GALLON) + "quarts");

}

}

Answer:

The output of the program is

A job that needs 18 quarts requires 4 gallons plus 2 quarts

Step-by-step explanation:

From the rearranged program above

At line 3, a global variable named QUARTS_IN_GALLON is declared

The Variable is declared as an integer

And the Variable is initialised to 4

At line 5, a local Variable is declared

The Variable is declared as an integer

And the Variable is initialised to 18

At Line 7, some arithmetic operations are done and the result of the Calculation is printed alongside some strings

The first operation is quartsNeeded/QUARTS_IN_GALLON

This is an integer division and the result will be in integer.

So, 18/4 = 4

The second operation is quartsNeeded%QUARTS_IN_GALLON

This means the remainder of the integer division

So 18%4 = 2

Then, the final step is to execute the print operation which outputs the following

A job that needs 18 quarts requires 4 gallons plus 2 quarts

You might be interested in
Is this equation possibale<br> 3+x=2-3x
Archy [21]
3-2= -3x-x
1 = -4x
x = -1/4

Yes it is possible
4 0
3 years ago
Read 2 more answers
Plz answer as soon as possible
Mamont248 [21]
THE FIRST ONE AND THE LAST ONE
3 0
3 years ago
Calculate the average of 7,081 and 8,890.
ASHA 777 [7]
Do you mean add are subtract
i will glad to help in comments
if you awnser

7 0
3 years ago
Read 2 more answers
7/4 x 16/5 as a inproper fraction if posibble
creativ13 [48]

Answer:

28/5

Step-by-step explanation:

6 0
2 years ago
Select all equations that have the same solution as 3x - 12=24
Evgen [1.6K]

Answer:

4

Step-by-step explanation:

3x-12=24

-12 to both sides

3x-12-12=24-12

3x=12

3x/3=12/3x

x=4

7 0
3 years ago
Other questions:
  • 2x+5x-11=-46 solve it.
    10·2 answers
  • What percent of 34 is 39?
    11·2 answers
  • If you were to solve the following system by substitution, what would be the best
    15·2 answers
  • Help me please ASAP !!!! Please
    14·2 answers
  • Hat is the slope of the line represented by the equation y = x – 3
    8·2 answers
  • Iv) You have 10 gallons of lemonade to sell (1 gallon = 3785 cm3). Each customer
    10·2 answers
  • Please answer this question!!!!! Geometry
    10·2 answers
  • Please help ASAP
    11·1 answer
  • Old Granny Adams left half her money to her granddaughter and half that amount to her grandson. She left a sixth to her brother,
    7·2 answers
  • Evaluate the expression (3-2i)(3-2i) and write the result in the form a+bi ,where a is the real part of your answer and bis the
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!