Skip to content

Latest commit

 

History

History
11 lines (10 loc) · 736 Bytes

README.md

File metadata and controls

11 lines (10 loc) · 736 Bytes

Khan-Project0

Problem 2.23: (Cost of Driving) Write a program that prompts the user to enter the distance to drive, the fuel efficiency of the car in miles per gallon, and the price per gallon then displays the cost of the trip.

Build Procedure: Step 1: Import Scanner class from Java.util Step 2: Use Scanner to prompt and collect user input for driving distance Step 3: Use Scanner to prompt and collect user input for miles per gallon Step 4: Use Scanner to prompt and collect user input for price per gallon Step 5: Divide driving distance input by miles per gallon input to find gallons used Step 6: Multiply price per gallon by gallons used to find total cost of driving Step 7: Print final string stating the cost of driving