Found 1 repositories(showing 1)
StevenDewey
Part 1 – User Input (4 points) Prompt the user for the following input: The estimated miles driven per year The estimated price of a gallon of gas during the 5 years of ownership The initial cost of a hybrid car The efficiency of the hybrid car in miles per gallon The estimated resale value (a dollar amount) for a hybrid after 5 years The initial cost of a non-hybrid car The efficiency of the non-hybrid car in miles per gallon The estimated resale value (a dollar amount) for a non-hybrid after 5 years The user's buying criterion, either minimized "Gas" consumption or minimized "Total" cost. Assume the user will enter one of these two strings Make sure that you prompt in this same order. If you do not, you will be marked off. Verify that all numerical inputs are positive. You will need to check each number individually and reprompt immediately in the event of bad numeric input (including 0). Output a message that only positive numbers are valid and reprompt one more time. You may assume that the second value will be a positive number. Part 2 – Output Costs (12 points) For both cars, your program should output the following: A label indicating whether the car is Hybrid or Non-Hybrid The total gallons of fuel consumed over 5 years The total cost of owning the car for 5 years (fuel cost + depreciation in car value) For the last question you prompt for, if the user's criterion is "Gas", then provide the output for the car with the lower gas consumption first. If the criterion is "Total", then provide output for the car with the lowest total cost first. For every case, you will need to provide output for both vehicles, each with the total cost and the total gallons used. The points will be distributed as follows: Computing the correct fuel consumption (4 points) Computing the correct total cost (4 points) Printing in the correct order (4 points) Good Coding Style (4 points) Does your code exemplify the good coding habits taught in class? Requirement Notes: No magic numbers (any numeric literal, such as 5 or 3.
All 1 repositories loaded