Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write av program that displays can information and the cost of the Common has manufacture, model number and consumption efficiency. There are two type of

image text in transcribed
image text in transcribed
image text in transcribed
Write av program that displays can information and the cost of the Common has manufacture, model number and consumption efficiency. There are two type of com lectric car and petrol car. An electric car specifies the battery level and the moved distance while the petrol car specifies the fuel level and the moved distance. The cost of the consumption is the consumed petrol or electricity times the cost of 1 gallon of petrol or kilowatt of electricity. The cost of 1 gallon of petrol is OMR 0.985, while the cost of 1 kilowatt of electricity is OMR 0.03. The consumption is the efficiency times the moved distance. If the consumption is more than the battery level or fuel level then a message should be displayed "No Sufficient Fuel" or "No Sufficient Battery. The consumption efficiency of the petrol car is measured in gallon/kilometer while for the electric car is measured in kilowatt/kilometer. Assume that distances are in kilometers. Car 4 Electric Car Petrol Car 3:30 PM we were for the electric cars measured in kilowatt/kilometer. Assume that distances are in kilometers. Car Electric Car Petrol Car According to this description and the concepts of OOP, do the following: (6 points) Write the code for the class Car which has 1. Variables to store car information as described above. II. constructor with parameters to initialize car information III. Accesor method for the consumption efficiency IV. A method to return car information as follows: manufacture (model number consumption efficiency. For example, for Toyota as manufacture and Eases as Model and efficiency of 0.07 the return value should be Toyota (Eases)-0.07. Please solve it quickly

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

4. What advice would you give to Carol Sullivan-Diaz?

Answered: 1 week ago