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
Solve the Simultaneous equations : x+y=5; x-y=1​
earnstyle [38]

Answer:

x=3 and y=2

Step-by-step explanation:

These equations line up quite nicely, so let's use the elimination method.

x+y=5

+ x-y=1

-------------

2x=6.

Now that we added the two equations together, we only have x as a variable to solve. We now divide 2 from both sides

x=3.

Now we take our 3 and substitute it into one of the equations. I want to put it in the first one.

3+y=5.

We subtract 3 from both sides to get y=2.

We end up with the answers x=3 and y=2. If you plug them in to check, they make sense. 3+2=5 and 3-2=1. This answer is proven to be correct.

Have a nice day :)

5 0
3 years ago
Verify the identity.<br> tan^5x = tan^3xsec^2x -tan^3x
Oksi-84 [34.3K]
Tan^5x=tan^3x∗tan^2x
sin^2x+cos^2x=1
tan^2x+1=sec^2x
tan^2x=sec^2x−1
5 0
3 years ago
To avoid the pond, Fred must walk 10 meters south and 24 meters east. To the nearest meter, how many meters would be saved if it
Liula [17]

Answer:

26

Step-by-step explanation:

x^2=10^2+24^2

x^2=100+576

x^2=676

x=26

4 0
3 years ago
What is the slope of this line?<br> y = x + 12<br> m = [?]<br><br><br> Please help
Alika [10]

The slope of the line is 1

8 0
3 years ago
Read 2 more answers
Which is heavier 9 5/8 pounds or 9 3/4 pounds ? By how much?
Anika [276]

Answer:

9 3/4 is heavier by 0.125 pounds

Step-by-step explanation:

9 5/8 - 9 3/4 = -.125

9 3/4 - 9 5/8 = .125

5 0
4 years ago
Other questions:
  • Cheryl has a box that is in the shape if a rectangular prism its height is twice the length it's length is 3 times its width and
    7·2 answers
  • It is estimated that approximately 8.1% of Americans are afflicted with diabetes. Suppose that a certain diagnostic evaluation f
    13·1 answer
  • HELP!!! The length of the unknown side is _____. 6.7 7 10.8 1.73
    5·2 answers
  • Geometry question please help asap
    9·1 answer
  • What can you say about a solution of the equation y' = - y2 just by looking at the differential equation? The function y must be
    5·1 answer
  • The answer to this problem in in word form and expanded form
    12·2 answers
  • How many terms are in this expression?<br> 8- k
    9·2 answers
  • 2) An octagon has a length of 5x - 6. The perimeter of the
    12·1 answer
  • Find the term indicated in the expansion.<br> (x + 2y)*; fourth term<br><br><br> Helppppppp
    15·1 answer
  • I dont know how to do this XD
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!