Click here to Skip to main content
16,015,583 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
C++ Program:
Create a class Car having following data members.
• Model of the car
• Brand of the car
• Price of the car
• Built year
• Final price
• Fuel_type //Petrol or diesel
1. All data members of the class should be private.
2. Create a setter and getter method for each data member.
3. Use getter methods to return values of data members, not for displaying values of data
member.
4. Create another class named BMW having the following data members 1. PassengerAirBag,
AlloyWheels and number_of_AI_modules.
5. Create a constructor in child class that will initialize all the values of base class.
6. Create a template function for calculating the final price of the car. Final price can be
calculated by adding the price of the car with the tax value. (Tax value should be greater
than 25000 and its value should be in double datatype).
7. Default values of derive class data members will be “No” for passengerAirBag,
AlloyWheels and 0 for number_of_AI_modules.
8. Create a member function in derive class named shiftGear() that will increment the value
of counter by 1 whenever the shiftGear() is called and if the counter is reached to 5 then
again start back to 0.
9. Data members of derive class will also be private use encapsulation concept to set and
get the values of derive class data members.

What I have tried:

just trying to make this program.
Posted
Updated 9-Jul-21 9:06am

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
At start to need to Learn C++ tutorial to have the basic skills and install the Visual Studio for having an IDE.

Than fullfill every singel requirement of the task. Best is to comment when done. Like
C++
// Create a class Car having following data members.
class Car {
// Model of the car
string model; // remark: usage of std::string
;
With such steps you can create a so called prototype of your task solution. Than implementing the functions is a piece of cake.

So get started, or you may run out of time because you need to learn, practice and fullfill your task. ;-)
 
Share this answer
 
Quote:
Help me creating this C++ program or create a one please.

Just NO, you are not learning to beg others to do your homework.
This is only applying the course you got, it may be a little more complicated than previous homeworks, but let me tell you that real life problems are much more complicated, and often not as consistent.

So read again requirement, slowly and give it a try, and comeback when you have a specific problem (and your work as support of your problem).
 
Share this answer
 
We can't tell you anything beyond what's in the assignment. It's telling you to create a class, not an entire application. It's also telling you exactly what to put in the class.

So, this assignment is up to your and your note taking skills. You did take notes during the class, correct?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900