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]
4 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]4 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
Thank you all for helping me with every thing! I also need help with this one :)
Flauer [41]

Answer:

1.5/6

2.1/6

Step-by-step explanation:

5 0
3 years ago
Read 2 more answers
If you multiply two even numbers where the product be even or odd explain with an example
dybincka [34]

Answer:

Even

Step-by-step explanation:

Any two numbers you multiply together that are both even will always result in an even number. For example 48x24=1152. You can use any two even numbers and you will always get and even product.

8 0
4 years ago
How do I work out 3t-7=5t
Mrrafil [7]
3t-7=5t\ \ 3t-5t=7 \\\\-2t=7\ \ / :(-2)\\\\t=-\frac{7}{2}


7 0
4 years ago
Read 2 more answers
In a certain town 215 boys and 265 girls were born last year. What is the probability that a child chosen at random from among t
Tanya [424]

Answer:

What I think it is from 5 through 25 or something like that

5 0
4 years ago
Vector v has its initial point at (13, -7) and its terminal point at (3, -1). Write the vector in component form and find its ma
ANEK [815]

Join QuestionCove!! We have helpers willing to help!!

6 0
3 years ago
Read 2 more answers
Other questions:
  • Let y be the difference of two numbers such that one number varies directly as x while the other number varies inversely as x. I
    14·2 answers
  • Which would expression represents the quotient of 24 and 3 plus x?
    15·1 answer
  • 2.8% of 45 is what number? <br><br>I need the percent equation, the proportion, and the solution
    8·1 answer
  • Which expression is equivalent to 7 to the 3 power × 7 to the −5 power
    9·1 answer
  • Parallelogram RSTU is rotated 180° clockwise
    11·1 answer
  • Zzzxxzzzzzxzxxxxxxxxxxxx
    6·1 answer
  • Which equation has no solution?
    11·1 answer
  • Mrs. Saada is between 50 and 80 years old. If you divide her age by 9, the remainder is 1. If you divide her age by 4, the remai
    14·1 answer
  • How to solve 3.6 x 2.1? Please tell me step-by-step. Thank you!
    5·1 answer
  • Part of the graph of the function f(x) = (x + 4)(x - 6) isshown below.Which statements about the function are true? Selecttwo op
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!