(Java)Convert the QuartsToGallons program to an interactive application. Instead of assigning a value to the number of quarts, accept the value from the user as input.

class QuartsToGallonsInteractive
{
public static void main(String[] args)
{
// Modify the code below
final int QUARTS_IN_GALLON=4;
int quartsNeeded=18;
int gallonsNeeded; int extraQuartsNeeded; gallonsNeeded=quartsNeeded/QUARTS_IN_GALLON; extraQuartsNeeded=quartsNeeded%QUARTS_IN_GALLON;
System.out.println("A job that needs " + quartsNeeded + " quarts requires " + gallonsNeeded + " gallons plus " + extraQuartsNeeded + " quarts");

}
}

Answers

Answer 1

import java.util.Scanner;

public class QuartsToGallonsInteractive

{

public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);

final int QUARTS_IN_GALLON=4;

int quartsNeeded=0;

System.out.println("How many quarts do you need?");

quartsNeeded = scan.nextInt();

int gallonsNeeded, extraQuartsNeeded;

gallonsNeeded=quartsNeeded/QUARTS_IN_GALLON;  

extraQuartsNeeded=quartsNeeded%QUARTS_IN_GALLON;

System.out.println("A job that needs " + quartsNeeded + " quarts requires " + gallonsNeeded + " gallons plus " + extraQuartsNeeded + " quarts");

}

}

I hope this helps!

Answer 2

To modify a program is to rewrite the program in another way.

In order to make the program an interactive program, we have to remove the following program statement:

final int QUARTS_IN_GALLON=4;

The above program statement assigns 4 to the variable QUARTS_IN_GALLON.

This means that:

Each time the program is run, the value of QUARTS_IN_GALLON is always 4.

Next, we replace the statement with:

Scanner input = new Scanner(System.in)

int QUARTS_IN_GALLON;

QUARTS_IN_GALLON = input.nextInt();

So, the complete modified program is:

class QuartsToGallonsInteractive{

public static void main(String[] args){

Scanner input = new Scanner(System.in)

int QUARTS_IN_GALLON;

QUARTS_IN_GALLON = input.nextInt();

int quartsNeeded=18;

int gallonsNeeded; int extraQuartsNeeded; gallonsNeeded=quartsNeeded/QUARTS_IN_GALLON; extraQuartsNeeded=quartsNeeded%QUARTS_IN_GALLON;

System.out.println("A job that needs " + quartsNeeded + " quarts requires " + gallonsNeeded + " gallons plus " + extraQuartsNeeded + " quarts");

}

}

Read more about interactive program at

https://brainly.com/question/15683939


Related Questions

dash is a set of communication standard using for transferring file information between computers in a network​

Answers

Answer:

protocol

Explanation:

hope this helps.

А ________ provides an easy way for workers to Interact with thelr computers.

System Call

Command Prompt

FAT

GUI

Answers

THE ANSEER TO THIS IS GUI

A local bank has just one branch. It sets up a peer-to-peer network for all devices on the system. The bank would like to be able to have one technician administer the entire network from his location outside the bank without having to go to the bank each time there is a problem. Will this be possible for the technician?

Answers

Answer: C. It will not work because it needs to use a server in a central location to allow for the remote access they want.

Explanation:

The options are:

A. It will not work because it is not possible to have the technician administer from one single location.

B. It will work as long as a LAN network is established to facilitate the communication between devices.

C. It will not work because it needs to use a server in a central location to allow for the remote access they want.

D. It will work if it uses a WAN network to bring in all of the LAN networks to one central location.

A peer-to-peer network occurs when computer's are connected together and hence share resources are connected and share resources.

In the scenario in the question, the technician cannot administer the entire network from his location outside the bank. The technician will need to go to the bank whenever a problem occurs. This is due to the fact that there I need for a server that is in a central location in order to allow for the remote access they want.

Answer:

It will not work because it needs to use a server in a central location to allow for the remote access they want.

Explanation:

Can someone find out what this binary number thing is. Just find out the message, I'm having a difficult time

Answers

Answer:

Press alt and F4 to see answer

Explanation:

Conclusion for primary memory

Answers

Answer:

primary memory is also called main memory and also it stores information in the computer

Explanation:

A draft has the following:
Plot
Details
Transition Words
Important events in order

Answers

What do you have to do?

What additional uses of technology can you see in the workplace? List ways technology impacts
other careers not discussed in this module, such as finance, government, non-profits, and
agriculture.

Answers

People can be making the technology, technology can be used to help solve problems and help further educate people with what they are working on. Technology impacts agriculture because their are certain technology to help farmers farm fast and help water the land without needing a human to do it. Technology can help finance by helping people add and subtract rather than doing in their hand.

If you need to modify a features in a part created using the Mirror tool, you can make the change in the original feature and the feature on the other side of the mirror plane will be modified automatically.
Select Answer

False

True

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is TRUE.

Because when you are designing something and drawing anything and it is symmetric in shape and half of the part is created, then if you use mirror features, then the other half part will get created automatically.

If you need to modify the features in the original part of the drawing or design then the other side of the mirror plane will be modified automatically.

Because whatever you will make changes in the original part of the design, then the other part that is created by using mirror features will get modified automatically.  

Categorive the given websites based on their possible website structure
company website
bookstore website
computer-based
training modules
single product website
city library website
online in store website
Hierarchical
Sequential
Matrix
Hi

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

There are different website structures such as hierarchical, sequential, and matrix. These websites structure helps the designers to create a meaningful website.

In this question, it is asked to categories the given website into their website structure.

The given websites are:

company website bookstore website computer-based  training modules  single product website city library website online in-store website

Now, we will categorize these websites into their website structure:

Hierarchical website structure:

Bookstore website

city library website

online in-store website

Sequential website structure:

single product website

computer-based training module

Matrix website structure:

Company website.

Here are the categorizations of the given items based on their storyboarding techniques:

Computer-based training modules: Linear

School website: Webbed

Bookstore website: Webbed

Single-product website: Linear

County library website: Webbed

Online gift store website: Linear

Federal government website: Hierarchical

Your manager has requested you keep a timesheet showing how many hours you work each day and what projects you work on during that time. Using spreadsheet software, how can you total your hours at the end of each week to provide a quick and accurate amount? Use the MIN and MAX functions. Use the AVERAGE function. Use the SUM function.

A: Use the MIN and MAX functions.
B: Use the AVERAGE function.
C: Use the SUM function.

Answers

Answer:

I had to use Microsoft Excel for a while when I was working as a dispatcher, inputting pricing and hours and such. C Would be the correct answer.

Explanation:

Average function would just average out the entire week. Though, if the entire week was 8 hours a day, the average would indeed be 8 hours. But it is not the correct answer if one assumes it's not steady like that. Min and Max, depending how it is setup will find the minimum number, and or the maximum number. Making that incorrect as well.

it is necessary to separate page numbers with a _____ when printing multiple pages of a document

A. Comma
B. Space
C. Period​

Answers

Answer:

A. Comma

Explanation:

In computer technology, a printer is an electronic output device (peripheral) that is used for the printing of paper documents (texts and images).

Generally, the standard text procedure for printing is to use sans-serif fonts for headlines and serif fonts for body text. This ultimately implies that, for any printed work such as novels, books, newspapers etc, it is a general rule for a printer to use sans-serif fonts for headlines and serif fonts for body text in order to enhance readability.

Also, it can be reversed in some instances by using a serif font for headlines and a sans-serif font for the body of a text.

Sometimes, when printing a document, an end user may wish to print multiple pages at a goal without any break. In order to achieve this, the user should enter the number of the pages while separating them with a comma in the print dialog box such as 1, 3, 15, 20.

Hence, it is necessary to separate page numbers with a comma when printing multiple pages of a document.

Additionally, you should use a comma for a non-sequential page (1, 3, 7, 15) and a dash for a sequential page (1-9) when printing multiple pages of a document.

4.9 Code Practice Question 4

Write a program that asks the user to enter ten temperatures and then finds the sum. The input temperatures should allow for decimal values.

Sample Run
Enter Temperature: 27.6
Enter Temperature: 29.5
Enter Temperature: 35
Enter Temperature: 45.5
Enter Temperature: 54
Enter Temperature: 64.4
Enter Temperature: 69
Enter Temperature: 68
Enter Temperature: 61.3
Enter Temperature: 50
Sum = 504.3

Answers

total = 0

for x in range(10):

   temp = float(input("Enter Temperature: "))

   total += temp

print("Sum = {}".format(total))

I hope this helps!

What is a good way to become a game developer without spending a lot of money?

Answers

Answer:

Codes

Explanation:

learn the codes first. when you're already expert, you'll find ways from there.

Which of the symbols below is present on the bottom row of the keyboard?
A.
apostrophe
B.
semicolon
C.
colon
D.
comma

Answers

Answer:

The correct answer is D: comma.

Explanation:

The comma is located on the bottom row of the keyboard to the right of the 'M' key.

Is the flow of power reversible in a leadscrew?

Answers

Explanation:

The flow of power is not reversible. The lead screw's force is increased. It's direction of travel is reversible. ... Increases force, not torque, because the output is in a linear direction.

When an object is acted on by unbalanced forces, the object will always

Answers

Answer:

If an object has a net force acting on it, it will accelerate. The object will speed up, slow down or change direction. An unbalanced force (net force) acting on an object changes its speed and/or direction of motion. An unbalanced force is an unopposed force that causes a change in motion.

Explanation:

please help in this question​

Answers

Answer:

B. 1980's

Explanation:

Python, the programming language, was found in 1980's.

what does the network access server (NSA) do?

Answers

network access server (NAS) is a computer server that enables an independent service provider (ISP) to provide connected customers with Internet access. A network access server has interfaces to both the local telecommunication service provider such as the phone company and to the Internet backbone

Select the correct text in the passage.
Select the sentence that is not the correct use of technology in parenting.
Technology has helped parents to access a vast information resource due to the presence of the internet. They can show a range of education
material like nursery rhymes, stories, scientific concepts, and so on conveniently on their smartphones. Teachers can coordinate with the
parents about the child's progress due to smartphones and various applications on it. Some parents have replaced the customary practice of
reading a bedtime story to children with a television show of the child's choice.
Reset
Next

Answers

Answer:

some parents have replaced the customary practice of reading a bedtime story to childern with a television show of the child's choice

Explanation:

Kelly arrives for work at a restaurant at 5:00 p.m. Once there, she washes and chops vegetables, then sets aside ingredients and organizes them for the cook. Kelly is most likely a . Mark's work hours change every week, depending on when he is needed. He wears a suit and tie to work at an elegant restaurant. He greets guests and seats them in a waiting area. He then guides them to their tables. Mark is most likely a

Answers

Answer:

ExplanKelly arrives for work at a restaurant at 5:00 p.m. Once there, she washes and chops vegetables, then sets aside ingredients and organizes them for the cook. Kelly is most likely a  

✔ Food Preparation Worker

.

Mark's work hours change every week, depending on when he is needed. He wears a suit and tie to work at an elegant restaurant. He greets guests and seats them in a waiting area. He then guides them to their tables. Mark is most likely a  

✔ Host

Answer:here's the answer for this question

Explanation:edge2023

what is displayed as a result of executing the following code segment?


x < - - 2
y < - - X * 4
z < - - X * Y
x < - - X + Y
z < - - z + ( x - y) * 3
DISPLAY ( x + y + z)

select one answer
A - 72
B - 40
C - 8
D - 54​

Answers

The first one I’m not sure it’s quite complicated

Coding question. Please help me?

Answers

Answer:

a  for a loop

Explanation:

the auxiliary device used to store large volume of data and program for future is called​

Answers

Answer:

Auxiliary memory units are among computer peripheral equipment. They trade slower access rates for greater storage capacity and data stability. Auxiliary memory holds programs and data for future use, and, because it is nonvolatile (like ROM), it is used to store inactive programs and to archive data.

Explanation:

hope the answer was helpful...

What are the components of a computer system

Answers

Answer:

The motherboard

Explanation:

if a friend asked you to help her decide what internal sabling system to install in her new house, what kinds of questions wouls you ask her to do? why would you ask those questions?​

Answers

Answer:

Assuming you mean *cabling system*

you could ask:

- The architectural structure of the building, which houses for the cabling installation.

- The function of the cabling installation.

- The configuration of an already installed system (upgrades and retrofits).

others

- The cable and connection products.

- The types of equipment the cabling installation will support -- present and future.

- Customer requirement.

Match each field of engineering to its application.

Answers

can you post a picture of the question please?
Hmm can you please send the pic

How would I copy this image?

There is an image from a scientific research pdf that I would like to use for one of my research papers in school, but I am unable to find out how to copy it and then paste it into my paper.

Thank you for your hep

Answers

Question: How would I copy this image?

Answer: Either screenshot it, or CTRL C ± CTRL V it. To screenshot something, open 'snipping tool' and pull up the PDF, then box in whatever you are trying to copy. You can also reverse image search it to find it somewhere on the web.

Uplifting Note: To you, smiling at someone may mean nothing, but to them, it might be their whole world.

If you want to remove meeting responses from your inbox but still want to see tracking options, what should you do? Turn off all meeting responses in the Calendar options. Sort and delete the meeting responses from your inbox. Change the Calendar view to a side-by-side comparison. Create a tracking rule that moves responses to a new folder.

Answers

Answer:

its D. create a tracking rule that moves responses to a new folder.

Explanation:

i just got the answer right on edge 2020.

Answer: In the image below

Explanation:

Use the table and the drop-down menus to order the
steps.
Click on the New tab.
Click on the Save or Save As tab.ha
Click on the Blank workbook image.
Type data into the columns and rows.
Create file name and choose location of file.

Answers

Answer: 2, 6, 3, 4, 7

Explanation:

Answer:

2

6

3

4

7

Explanation:

numA = 2 while numA < 30: numA = numA * 5 print(numA)

Answers

Answer:

Your print will be

10

50

Explanation:

Answer:

50

Explanation:

Other Questions
Can someone plz help really quickly!? Thank you! Marking brainlyest to to the first and correct answer!! Worth a lot of points to!! making her way across a meadow of tall grass, Kristen fans the air as a cloud of gnats hover in front of her Find the value of n.9 x -1 x n = 9 x -3 help, Ill give brainliest and thanks Multiply 8674 x 678 is what who can help me on my math homework for 10 points asp Please help! I am struggling to understand this! PLZ HELP! What is the domain and range for the function graphed tothe left? A sticker has a length of 4 inches. If Gary places the stickers end to end, how many can he fit on a banner that is 12 feet long? ( 1 foot = 12 inches ) explain why thank you!!!!A) 144B) 38C) 36D) 42 Chromosomes create genes true or false What kinds of questions does Hitchcock hope his audience will ask while they watch the movie Rope? How do they build suspense? Refer to one or more details from the text to support your answer. PLACE THE FOLLOWING EVENTS IN ORDER OF HOW THEY HAPPEN: 1) YOUR ARM MOVES: 2) AN IMPULSE TRAVELS ALONGANERVE; 3) YOU DECIDE YOU WANT TO MOVE YOUR ARM. Place in order how did early roads change the U.S economy? PLEASE ANSWER QUICKLYFind the value of f(-142) for the function below.f(x) = -0.2(x + 223)A. 251.4B. -186.6C. 81D. -16.2 In the feudal system, what was a manor?A.a lord's estateB.a right to use landC.a customary way of doing thingsD.an obligation to provide protection Help! What are 3 court cases that helped John Marshall shape the Supreme Court? The recipe makes enough stew for 6 people, and the ingredients cost $9.75. How much would it cost to serve 24 people? Use the rate table to solve the proportion.StartFraction 6 over 9.75 EndFraction = StartFraction 24 over c EndFractionIt would cost $ to serve 24 people. Briefly describe ONE significant difference between Jackson's interpretation of government powers as expressed in his message to Congress and Webster's. Doreen drank a lot of water and now has to go to the bathroom more than usual. She is worried that something is wrong. What would you tell her? O A. Her kidneys were not functioning correctly and got rid of more fluid than they should have. O B. Her kidneys always send water right through the digestive system and out the bladder for elimination. O C. Her kidneys failed to function properly and discharged all the fluid. D. Her kidneys processed the excess water as waste. a company has recently been hiring new employees. today the company has 26% more employees than it did a year ago. if there are currently 69300 employees, how many employees did the company have a year ago