Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need java code please Write a program that uses a Scanner to ask the user for the gallons of gas in their gas tank. Read

Need java code please
image text in transcribed
Write a program that uses a Scanner to ask the user for the gallons of gas in their gas tank. Read in the user response as a double. Then write a loop that repeatedly decreases the gallons value by 0.1. The loop should stop when gallons becomes zero or less. And you must use an if statement inside the loop to print "Low Fuel" each time the gallons value is below 10% of the original given gallons value. You will need an additional variable to store a copy of the original amount. You may choose to print the percent of the original amount on each iteration of the loop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

For what purposes are departmental reports useful to management?

Answered: 1 week ago