Question
Please write a program that does the following: (1 Point) Provide the following menu (choices) to the user: o Enter trip data o Show Eco
Please write a program that does the following:
(1 Point) Provide the following menu (choices) to the user:
o Enter trip data
o Show Eco Score
o Exit program
Ask the user to choose from the menu
o (2 Points) Continue to show the menu (even with invalid choice give error message
but dont exit) until the user chooses Exit program.
For Enter trip data:
o (1 Point) Ask the user for:
- # miles traveled in the past 5 minutes
- Ask the user for gallons of gas consumed in the past 5 minutes
o (2 Points) Calculate total distance traveled, total gas consumed (gallons), MPG over the past 5 minutes, and cumulative MPG
o Ask the user if the user would like to add more data in 5 minute increments
- (2 Points) Allow the user to keep entering data in 5 minute increments until the user has no more data to enter
o (1 Point) Return to the menu when the user is done entering trip data
For Show Eco Score
o (2 Points) Show total distance traveled, total gas consumed, and cumulative MPG
o (3 Points) Show an appropriate message (you decide the message) for when cumulative MPG is: Over 100, between 50 and 100, between 30 and 50, between 10 and 30, and below 10.
o (1 Point) Return to the menu after displaying message
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started