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
The credit remaining on a phone card is a linear function of the total calling time made with the card. The remaining credit aft
dolphi86 [110]

If you need the answer so go to the google and search for problem

5 0
3 years ago
Which statement is not correct?
Pachacha [2.7K]

Answer:

b.) because it is over 90*

Step-by-step explanation:

8 0
2 years ago
If there are 420 woman and 330 men what are their %?
atroni [7]
56% women and 44% men. To solve add total number of people (750). Divide the number of men by the number of total people to get the percent of men in decimal form (0.44) and multiply by 100 to get 44%. The remaining 56% is the amount of women.
3 0
3 years ago
Read 2 more answers
A segment in the coordinate plane has an endpoint with coordinates (1,2) and midpoint with coordinates (4,3). What are the coord
Serga [27]

Answer:

(7,4)

Step-by-step explanation:

midpoint formula (x1+x2)/2 , (y1+y2)/2

Look at x and y for the endpoints separately

midpoint x value = ( 1 + x)/2

4= (1 + x)/2

8 = 1 + x

x = 7

midpoint y value =  (2 + y)/2

3 = (2 + y)/2

6 = 2 + y

y = 4

endpoint (x,y) = (7,4)

8 0
3 years ago
What is the coefficient of y in the expression 2 ⋅ 4 + 3y?
zvonat [6]
The coefficient of y in this expression is 3 
4 0
3 years ago
Read 2 more answers
Other questions:
  • 2*5(6–8)7-8(58-7) please help my solve
    14·1 answer
  • given the equation -4 square root of x-3=12, solve for x and identify if it is an extraneous solution
    7·1 answer
  • Toni can carry up to 18 lb in her backpack. Her lunch weighs 1 lb, her gym clothes weigh 2 lb, and her books (b) weigh 3 lb each
    5·2 answers
  • From the set {36, 16, 13}, use substitution to determine which value of x makes the equation true. 3x = 39
    8·2 answers
  • What is the value of the expression?<br> 2(−5.25)
    13·1 answer
  • It’s a multiple choice so it’s like 3 answers but help please
    12·1 answer
  • 4. The school's soccer team is made up of 3 grades. Grade 10s make up 17% of the team
    5·1 answer
  • PLEASE HELP!!!!! PEOPLE ARE GETTING THEM WRONG FOR ME!!!
    7·1 answer
  • The circumference of a circle is 147 cm.<br> What is the radius of the circle?
    11·1 answer
  • I need help pls ill give brainlest
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!