Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 form

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

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions