Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

fscanf retums a special value EOF that stands for...

Answered: 1 week ago

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago

Question

=+j on to staff their operations in the global marketplace.

Answered: 1 week ago