2020-10-31

How do I write a program that asks for user input and uses it to form new variables which I use to calculate something in java [closed]

How do I write a program that asks for user input and uses it to form new variables which I use to calculate something in java. It also keeps on repeating until the user tells it to stop.

Actual Question:

Write a program that calculates miles per gallon for a list of cars. the data for each car consists of initial odometer reading, final odometer reading, and number of gallons of gas. The user signals that there are no more cars by entering a negative initial odometer reading.

Example of how it should look like in the end)

Miles Per Gallon Program

Initial miles: 15000
Final miles: 15250
Gallons: 10
Miles per Gallon: 25.0

Initial miles: 107000
Finals miles: 107450
Gallons: 15
Miles per Gallon: 30.0

Initial miles: -1
bye


from Recent Questions - Stack Overflow https://ift.tt/2GimOKG
https://ift.tt/eA8V8J

No comments:

Post a Comment