Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I have this lab for my Java class and need help. Thank you. You have to write a new program that calculates the miles
Hello, I have this lab for my Java class and need help. Thank you.
You have to write a new program that calculates the miles per gallon and cost of driving one mile for each of the different types of cars. The student will use strings, variables, assignment statements, output statements to communicate with the user. The project (named Lastname_L01) should have appropriate variables. The program declares and assigns realistic values to appropriate variables for five types of cars (1) sedan (2) coupe (3) sports (4) suv (5) van. The program should print the variable values and output in a nice tablulated format. For each vehicle type assign the following values (you can give your own different realistic values) for (a) miles driven (b) Gallons used (c) cost per gallon. Then for each car type compute the miles per gallon and the cost of driving one mile. For example, For Sedan: SedanMiles Driven = 100, SedanGallonsUsed = 7, SedanCostPerGallon = $2.45. Using these values compute Sedan MilesPerGallon and SedanCostPerMile. Print all values in a neatly tabulated formStep 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