Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding Question Code the complete header file content of a class called Car with the following requirements: [16 marks] Note: you only need to write

Coding Question

image
Code the complete header file content of a class called Car with the following requirements: [16 marks] Note: you only need to write the class, its attributes and the desired method prototypes; no function definitions are to be written This class will encapsulate a Car with the following information: Namespace name. tesla Encapulated attributes: . License plate Capacity (maximum number of passengers) . Make and Model (Dynmically allocated Construction and Destruction: The class should be able to be constructed in one of the following ways 1- Using Make-Model , License plate and capacity In this case, if capacity is not provided, it is to be set to 4 by default. 2- With no information provided. (Invalid empty state) Destruction: When going out of scope the class should deallcated its dynamic memroy. Operators: 1- A Car can be set to an integer using assignment operator (to set its capacity) 2- A Car can be set to a Cstring using assignment operator (to set its Make and model) 3- If casted to a boolean it should return if it is in a valid state or not. 4- sum of two cars should return the sum of the capcity of the cars using the + operator

Code the complete header file content of a class called Car with the following requirements: [16 marks] Note: you only need to write the class, its attributes and the desired method prototypes, no function definitions are to be written This class will encapsulate a Car with the following information: Namespace name: tesla Encapulated attributes: . License plate Capacity (maximum number of passengers) Make and Model (Dynmically allocated Construction and Destruction: The class should be able to be constructed in one of the following ways 1- Using Make-Model, License plate and capacity In this case, if capacity is not provided, it is to be set to 4 by default. 2- With no information provided. (Invalid empty state) Destruction: When going out of scope the class should deallcated its dynamic memroy. Operators: 1- A Car can be set to an integer using assignment operator (to set its capacity) 2- A Car can be set to a Cstring using assignment operator (to set its Make and model) 3- If casted to a boolean it should return if it is in a valid state or not. 4- sum of two cars should return the sum of the capcity of the cars using the operator.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here is the complete header file content of the Car class based on the given requirements cpp namesp... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Find a rational function f having the graph shown. HIP -4-2

Answered: 1 week ago