2.9. Miles-per-gallon - Java

Words
108
Reading
1 min
Listen
Play
10y

Starting out with Java: From control structures through objects

Chapter 2

Programming Challenges

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

9. Miles-per-gallon

A car’s miles-per-gallon (MPG) can be calculated with the following formula:

MPG = Miles driven / Gallons of gas used

Write a program that asks the user for the number of miles driven and the gallons of gas used. It should calculate the car’s miles-per-gallon and display the result on the screen.

Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (6th Edition) (Page 106 - 107). Pearson. Kindle Edition. 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

Bitcoin Address - 12uPbtoTBgxKG3ppxC2NSJYmmr5qipsbds

Ether Address - 0xb6f7D2d2127a56aF7D55CdBD7d327439A9005abF

Change tip address - kakradetome.tip.me

email - [email protected]

Thanks :)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

2.9. Miles-per-gallon - Java | Ecency