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
Chris wanted to know how likely he is to win at his favorite carnival game. He conducted 50 tests and won 15 times. What is the
aleksklad [387]

Answer:

b.) 0.30

Step-by-step explanation:

15/50 = 0.3

3 0
2 years ago
Help me please I don’t know this
ExtremeBDS [4]

its a m8 a a a  a a aa aaa

8 0
3 years ago
A painting measure 40 cm by 35 cm how many squared cm does its surface cover
miskamm [114]

Answer: Its surface covers  1400 cm²

Explanation:

Since the length of painting = 40 cm

Breadth of painting = 35 cm

Since we know that area of rectangle is product of dimensions.

∴ Area of painting = length × breadth

= 40 cm × 35 cm

= 1400 cm²

∴ Its surface cover  1400 cm².

8 0
3 years ago
Forty-two times twenty-seven
sammy [17]
1,134. :DD Hope I helped!
3 0
3 years ago
Read 2 more answers
How can tell if a table values is proportional
Gnoma [55]

Answer:

You can

Step-by-step explanation:

To see if multiple ratios are proportional, you could write them as fractions, reduce them, and compare them.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Drake wants to save $750 so that he can take a class on computer analysis for cars. The class is being held on various dates ove
    11·1 answer
  • Is the function y= – x+3 linear or nonlinear?
    8·2 answers
  • Which of the following is the Spanish expression for "me too"?
    8·2 answers
  • Doug can download new songs for $1.19 each. Write an equation to show how many songs he can download for $12.00
    15·2 answers
  • I need help its for 7th grade math​
    8·1 answer
  • 3+(4+5) = ( 3+4 ) +5.THIS IS AN EXAMPLE OF THE ---------OF WHOLE
    9·2 answers
  • Howdy, I need help with an algebra question, thanks! (I'll give you brainlist too)
    13·2 answers
  • What is m Angle Q B O? 5° 9° 12° 24°
    7·1 answer
  • your job pays 8$ per hour Write a variable expression for your pay in dollars for working h hours. What is your pay if you work
    12·1 answer
  • Write an equation of the line with the given slope, m, and y-intercept (0,b).<br><br> m = 8, b = 9
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!