Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please follow all the requirements and conditions carefully. You will have to make three files :- 1) Header file which will include the class and

image text in transcribed

Please follow all the requirements and conditions carefully.

You will have to make three files :-

1) Header file which will include the class and class definition (proto-types).------( Car.h )

2) A cpp file which will include all the function definitions.-------( Car.cpp )

3) A main file which will only have int main.------ ( Car.main )

Tasks :- Write a class Car in C++ and use it in the main. The car has following properties: Make Model Engine Number Chassis Number Color Registration Number (number plate) Year of registration Number of kilometers travelled Amount of total fuel consumed Max Fuel Capacity Current fuel in the tank Current health of tyres ( 1 to 100 ... 100 being the full health) Engine Oil (in liters) Owner Name Passenger Capacity

Car has following behaviors Car can: Drive Forward Turn Right Turn Left Run reverse Stop Refuel Change Tyres (always add new) Add Passenger (driver isa passenger as well) Remove Passenger Print Summary Here are the rules for these behaviors On every drive forward, car consumes 1 liter of fuel and runs 10 km. It will also reduce tyre health by 0.5. This fuel and tyre consumption is for only 1 passenger. The consumption of fuel and tyre will cause additional 10% fuel consumption and 10% additional reduction in health of tyres per additional passenger. On every turn left and turn right, car consumes 0.05 liters of fuel, runs 0.01 km of distance and reduces tyre health by 0.3. This fuel and tyre consumption is for only 1 passenger. The consumption of fuel and tyre will cause additional 10% fuel consumption and 10% additional reduction in health of tyres per additional passenger. On every drive reverse, car consumes 0.05 liters of fuel, runs 0.01 km of distance and reduces tyre health by 0.1. This fuel and tyre consumption is for only 1 passenger. The consumption of fuel and tyre will cause additional 10% fuel consumption and 10% additional reduction in health of tyres per additional passenger. Car cannot drive, turn left, turn right or drive reverse if theres no fuel or the tyre health is zero. You can refuel the car to maximum fuel capacity You can change tyres to install new. New tyres always have tyre-health=100 You can add passenger or remove passenger and the fuel consumption will change as per above rules. You cannot remove all the passengers, at least 1 should remain, and you cannot add more passengers than the capacity of the car Print will print all the details related to the car.

Thanx in Advance for your help.

General Instructions Your formatting of the output must be reasonable You must delete any dynamically allocated memory when no longer required and assign null to the respective pointer. Failure to meet this requirement will result in loss of marks 1. 2. 3. Use reasonable names for the variables for better code readability . Your code must be properly indented

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

=+7 What is the overall cost of the international assignment?

Answered: 1 week ago