bossdde
15.02.2020 •
Mathematics
// 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"); } }
Solved
Show answers
More tips
- F Family and Home How to Choose Suitable Windows for Your Home?...
- C Computers and Internet Why is Yandex s robot Bless.yandex.ru Important?...
- F Food and Cooking Fresh and Easy Lemonade in 10 Minutes...
- S Sport How to wrap boxing hand wraps? Everything you need to know!...
- F Family and Home How to Sew Curtain Tapes: Best Tips from Professionals...
- A Animals and plants How to Grow Lime from a Seed: Simple Tips and Interesting Facts...
- C Computers and Internet How to Create a Folder on Your iPhone?...
- G Goods and services How to sew a ribbon: Tips for beginners...
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
Answers on questions: Mathematics
- M Mathematics Asurvey company asks all respondents for demographic information. there are 8 age and 7 income groups, 5 gender choices, and 6 choices for ethnicity. how many people would this...
- M Mathematics Wayne inc., a health insurance company, pays clerks an incentive based on the average amount of work completed per hour. wayne pays $10 for processing 20 invoices per hour. an...
- M Mathematics Aresearcher hypothesizes that undergraduate college students eat fast food more often than graduate students. the researcher selects two random samples (one of undergraduate students...
- M Mathematics Amarketing manager wants to predict customers with the risk of churning (switching their service contracts to another company), based on the number of calls the customer makes...
- M Mathematics If x and y are random variables, the sum of all the conditional probabilities of x given a specific value of y will always be: -0.0-1.0-the average of the possible values of x.-the...
- M Mathematics The natural fertilizer company,using the following data. assume that the company produces 100 pound sacks of 35-20-20 fertilizer for lawns and 100 pound sacks of 14-13-12 fertilizer...
- M Mathematics Construct a level α likelihood ratio test (lrt) to test h0 : µx − µy ≤ −δ h1 : µx − µy −δ. q2(1pt): similarly construct a level α lrt to test h0 : µx − µy ≥ δ h1 : µx − µy δ q3(2pt):...
- M Mathematics Asurvey of 500 shoppers was taken in a large metropolitan area to determine various information about consumer behavior. among the questions was, do you enjoy shopping for clothing?...
- M Mathematics Substitute values into the equation to complete the table, then state whether the equation represents a function. Explain your reasoning y = 5x+1...
- M Mathematics Please help :) i need help...
Ответ:
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");
}
}
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
Ответ:
B. 1 and 64, 2 and 32, 4 and 16, 8 and 8
Step-by-step explanation:
1 • 64 = 64
2 • 32 = 64
4 • 16 = 64
8 • 8 = 64