Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i need dev c++ code for this question plz help.
You need to develop a C++ program for a company which buy and sell used cars and sports bikes. The company has a garage with separated but limited spaces for both types of vehicles. For example, their garage has capacity for 5 bikes and 5 cars. Your program should allow the company to define these numbers by themselves. When the company purchases a vehicle, they immediately add it to their garage but when they sell one, they do not remove it from their garage. Technically, they should give the purchased vehicle to its owner and empty the space for another vehicle, but they do so because they do not want to make things complex for you. It means that the space in garage is occupied by both sold and available vehicles. The company also wants your program to list bikes and cars separately. Both lists must clearly indicate which vehicle is available for selling and which one has already been sold. Each vehicle in its corresponding list should be listed along with all its features.
When the company make a purchase and add a vehicle to the garage, they store the following features and attributes:

What I have tried:

sir i tried to solve but i don't understand how to code for this
Posted
Updated 16-Jul-20 22:11pm
v2

Read the question carefully. It contains all the instructions you need when combined with the recent lectures. So read your course notes for those as well.

This is not the first time today we have seen this homework: so you might want to talk to some of your classmates about the task.
 
Share this answer
 
The way I usually deal with a problem is I start listing the types of objects I will need. Then I list the data items or properties each object has or needs. For your problem, you have garage spaces and vehicles. A Vehicle can be a bike or a car. Similarly, a garage space can hold a vehicle and it has its own set of properties. Make this list for yourself and then define classes for each type of object and the properties they have.

You have to start somewhere and this works pretty well for me. You should give it a try.
 
Share this answer
 
Take a look at this C++ tutorial which also uses a car class.

Tip: you must divide your task in very small chunks and than implement one after the other. Like you need a company class with a bike and a car array. And they need a available or sold flag.
 
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