Question: Rewrite your program so it calculates the fuel needed and total fuel cost of a trip. The program will perform the following tasks: ( a
Rewrite your program so it calculates the fuel needed and total fuel cost of a trip. The program will perform the following tasks:
a Display Welcome to your names fuel cost calculator.
b Ask the user to enter name of a trip destination.
c Ask the user to enter the distance to that trip destination in miles and the fuel efficiency of their car in mpg or miles per gallon
d Calculate the fuel required to get to destination and display it
i Use the formula: Fuel amount Distance Fuel efficiency, where Fuel is in gallons, Distance is in miles and Fuel efficiency is in miles per gallon.
ii Your program should follow Java convention for variable names camelCase
e Ask the user to enter fuel price in dollars per gallon in their area.
f Compute trip cost to get to destination and display it
i Use the formula: Trip fuel cost Fuel amount x Fuel price, where trip fuel cost is in dollar amount, fuel is in gallons, and fuel price is in dollars per gallon.
ii You need to convert this mathematical formula to a Java statement. Be sure to use the right operator symbols! And, as before, follow Java convention for variables names camelCase
g Compute and display total fuel cost for round trip, to reach and return from destination, using the formula: Round Trip Fuel Cost x Trip fuel cost
i You need to convert this mathematical formula to a Java statement!
h Display Thank you for using your names fuel cost calculator.
Compile and test the program to make sure it works see the Example Input and Output section below.
Hand in the source file:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
