Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prompts the user to enter the capacity of his car's fuel reservoir in liters, the percentage of how much fuel

 

Write a program that prompts the user to enter the capacity of his car's fuel reservoir in liters, the percentage of how much fuel is remaining in the reservoir and the consumption rate of his car in liters per 100 Km. The program will then: Calculate the remaining fuel amount: fuel amount = capacity * remaining percentage fuel amount 100 Calculate the distance for which this fuel amount is enough: distance comsumption rate 72 The cost of refilling the car: cost (capacity-fuel amount) * 20 The program will then display all the information as shown in the sample run below Sample Run: Enter the total capacity of your reservoir in Liters: 65 Enter the percentage of the remaining fuel: 0.4 Enter the consumption rate of your car in Liters/100Km : 12.5 The remaining fuel amount is 26.0. The distance that you can travel with the current fuel amount is 208.0Km. The cost of refilling your car is : 140.4 Java langauge

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

import javautilScanner public class Main public static void mainString args int total... 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

Document Format ( 2 attachments)

PDF file Icon
635f6667cc02c_231858.pdf

180 KBs PDF File

Word file Icon
635f6667cc02c_231858.docx

120 KBs Word File

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

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

Calculate the missing values for the promissory notes described

Answered: 1 week ago