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
What's 676 divided by 13 in long division? I need step by step cause you have to drag the numbers.
Galina-37 [17]

Answer: 52

Step-by-step explanation: Not much work with this one but hope this helps :)

3 0
2 years ago
Examine the equation.<br><br> –2(–x + 9) = 2(x – 9)<br> 2x – 18 = 2x – 18<br> This equation has
kolezko [41]

Answer:

infinite solutions

Step-by-step explanation:

6 0
3 years ago
Read 2 more answers
A local charity receives 1/3 of funds raised during a craft fair and a bake sale. The total amount given to the charity was $137
g100num [7]

Answer:

$412.35

Step-by-step explanation:

8 0
3 years ago
Read 2 more answers
Given (1, -3) and (5, 1). The slope of the line is The equation of the line is
guapka [62]

To find the slope of the line we can use the following formula:

\frac{y.2 - y.1}{x.2 - x.1} = m

1 - (-3)/5 - 1

4 / 4

1

<h3>The slope of the line is equal to 1.</h3>

To find the equation, we can just use slope-intercept form.

We already know the slope, so our current equation is y = x

By knowing the slope, we can apply the slope to our lowest pair of coordinates to find the y value when x = 0.

Subtract 1 from the x and y values of (1, -3)

(0, -4) is our new point, and so we know the y-intercept is -4.

<h3>Our equation for the line is y = x - 4</h3>
4 0
3 years ago
Solve the missing tables part 2.
Nimfa-mama [501]
Hopefully this helps

3 0
2 years ago
Other questions:
  • A teacher wants to give 3 markers to each of he 25 students. Markers come in packages of 8. How many packages of markers will th
    10·1 answer
  • Which expressions are equivalent to 2(25)?
    15·2 answers
  • Please help!!<br>show work!!<br>please!!
    11·1 answer
  • Why do have to ignore the absolute value sign while solving differential equation?
    13·1 answer
  • Estimate by rounding 642÷83
    12·1 answer
  • A loaded grocery cart is rolling across a parking lot in a strong wind. You apply a constant force F⃗ =( 35 N )i^−( 37 N )j^ to
    13·1 answer
  • If the diameter of a circle is 25 inches, what is the radius of the circle?
    8·1 answer
  • Three students were given the expression shown to simplify.
    7·2 answers
  • 2617 to the nearest thousand
    13·2 answers
  • A board that measures 3/4 feet long is cut into 6 equal pieces. What is the length of each piece?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!