Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Good evening, Question was previously answered- Please see pervious answer. Further instruction is requested. I still need help. Please and Thank you very much Write

Good evening, Question was previously answered- Please see pervious answer. Further instruction is requested. I still need help. Please and Thank you very much

image text in transcribedimage text in transcribed

Write a Java program that calculates a user's gas mileage over 3 trips. Write a For Loop that asks the user two questions for each trip: how many miles the trip was (as a decimal number), and how many gallons of gas were used (as a decimal number). After the user has entered this information for each trip, calculate his/her total gas mileage and print it to the screen. The gas mileage can be calculated by dividing the total miles driven by the total number of gallons of gas used (over all trips). Sample output: This program will help you calculate your gas mileage over 3 trips. TRIP 1 How many miles was trip \#1? 3 How many gallons did you use on trip \#1? 1 TRIP 2 How many miles was trip \#2? 4 How many gallons did you use on trip \#2? 1 TRIP 3 How many miles was trip \#3? 5 How many gallons did you use on trip \#3? 1 Your total gas mileage was 4.0 miles per gallon. ablic class GasMileage

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is meant by a corporations having a separate legal identity?

Answered: 1 week ago