Question: 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

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: (9.5 points) Write the code for the class PetrolCoro 1. Variables to store petrol car information as described II. A constructor with parameters to initialize petrol caroration Ill. A method to calculate the cost of the consumption IV. A method to return petrol car information as follows. Petrol Car manufacture number)-consumption efficiency Gallon/KM, Fuel Level (the fuel level of the can Travelled Distance (the travelled distance) --> cost: OMR cost of the consumption. For example for Nissan as manufacture and Maxima as Model, efficiency of 0.0064 fuel level 460 distance of 340, the return value should be Petrol Car: Nissan (Maxima)-0.0064 --> cost: OMR 2.14336. Gallons/KM, Fuel Level (4.6) Travelled Distance (340.0) Paragraph Please solve it quickly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
