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
Adult tickets to a basketball game cost $5. Student tickets cost $1. A total of $2,465 was collected on the sale of 1,077 ticket
frez [133]
Assign x to adult tickets and y to student tickets, then set up the system
5x+y=2465 and
x+y=1077
You can subtract the second equation from the first to get
4x=1388
=> x=347
Then to find y do 1077-347 to find
y=730

Final answer:
347 adult tickets and 730 student tickets were sold.
Hope I helped :)
4 0
3 years ago
Read 2 more answers
The____ function is the most basic function in a family of functions
docker41 [41]
The answer is: parent function
7 0
3 years ago
Read 2 more answers
A woman earns 2600 per month and budgets 468 per month for food what percent of her monthly income is spent on food
finlep [7]

divide food money by income:

468 /2600 = 0.18 = 18%

3 0
3 years ago
In the following proportion, what does x equal?
trasher [3.6K]
A is the correct answer. 23/40=0.575 and 4.6/8= 0.575 as well.
6 0
3 years ago
Read 2 more answers
Please help me find the answer
MatroZZZ [7]

Answer:

use calculator

Step-by-step explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • NEEED HELP ASSSSAAAAPPPPP PLEASE
    13·1 answer
  • ANSWER ASAP!!!!
    8·1 answer
  • How many 2/3 cup servings of soup are in 4 cups of soup?
    9·2 answers
  • Find three consecutive integers whose sum is -57
    11·2 answers
  • I don't know the answer pls help fast I don't get it 25 points pls answer quick
    14·1 answer
  • Calculate the perimeter...
    12·2 answers
  • Which are integers and which are not<br> 36/4,-3.92,790.17,40,-12/19
    11·1 answer
  • 0.193, 0.6, 0.308, 0.26 in descending order
    12·1 answer
  • Of 600 students sampled, 480 said they hoped to own a house someday. With 99.7% confidence, what is the approximate percentage o
    12·1 answer
  • Oranges cost $3.42 for 9 pounds at that rate how much would 12 pounds cost
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!