| | |
Linked Lists Database...
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 20
Reputation:
Solved Threads: 0
Hello Everyone.
Project outline:
So far this is what I've come up with:
I made the following classes;
Car Class -- stores car model, car price
Dealer Class -- stores dealer name, dealer id
Transaction Class -- inherits from Car and Dealer
Distributor Class -- has the operation to add, remove transactions etc..
Node Class -- linked lists
I don't think I'm doing this right, Any suggestions on how to design this, on how many classes I should use would be appreciated.
Thank You.
Project outline:
•
•
•
•
I've to make a project which is the following:
I'm a Car Distributor that distributes(sells) cars to different Car Dealers I should have a stock class with all the different types of cars I have ej(Toyota: 100, Mistubishi: 220, etc...) each type of car should have its own price, each dealer should have a name and an id, i should make a database storing all that information, I should use linked lists with the restriction of the following libraries iostream, cmath, fstream, cstring.
I made the following classes;
Car Class -- stores car model, car price
Dealer Class -- stores dealer name, dealer id
Transaction Class -- inherits from Car and Dealer
Distributor Class -- has the operation to add, remove transactions etc..
Node Class -- linked lists
I don't think I'm doing this right, Any suggestions on how to design this, on how many classes I should use would be appreciated.
Thank You.
•
•
Join Date: Jul 2005
Posts: 1,678
Reputation:
Solved Threads: 264
I suspect you've posted your interpretation of what you're supposed to do. I suspect there are a few more details that exist in the original instruction set. Here's how I would start thinking of class design based on the information posted and trying to read between the lines:
C++ Syntax (Toggle Plain Text)
CarDistributor: has a name has a list of dealers has a total number of cars has a list of cars has a total inventory value has a list of each car model and the number of cars of that model can add, delete, display car dealers can add, delete, display cars can add, delete, display car models can display total number of cars can display a given model and number of cars of that model can display all models and number of cars of each model. can display models and number of cars of each model by dealer can display inventory value can change inventory value can search for a given car model by dealer CarDealer has everything a CarDistributor has except a list of CarDealers has an id can do everything a CarDistrubtor can except add, delete, etc CarDealers can display id Car has a model has a price can display model can display price Each has represents a member variable Each can represents a member function To make the various lists I'd probably have the following classes: CarNode to make a list of cars DealerNode to make a list of dealers Model Node to make a list of models
Last edited by Lerner; Mar 15th, 2008 at 10:45 pm.
•
•
Join Date: Jul 2005
Posts: 1,678
Reputation:
Solved Threads: 264
C++ Syntax (Toggle Plain Text)
Version 1: struct CarDealer { string name; void displayName(){cout << name;} }; struct CarDealerNode { CarDealer dealer; CarNode * next; }; Version 2 struct CarDealerNode { string name; void displayName() {cout << name;} CarDealerNode * next; };
You really need a good tutorial or book to assist you if you are going to try to do this with minimal knowledge of both classes and lists. There's a lot of details, options, etc to learn about and choose from.
•
•
Join Date: Mar 2008
Posts: 20
Reputation:
Solved Threads: 0
So If i wanted to do a Stock of car models for the Distributor I should make a Car Node ?
I need to make a stock which has a number of car types (Toyota, Mistubishi, etc..)
I should assign an initial value of how many cars I have ( Toyota 200, Mistubishi 100...)
Then when I sell for example 50 Toyotas and 20 Mistubishis It should be subtracted from
my stock, I also should be able to add new cars or add more Toyotas to my stock which will raise the number of the Toyotas I should also be able to add new models and set their prices...
Cal I achieve that by making a CarNode ? I'm really haveing a hard time thinking this though if theres no much trouble could you give me a code example ?
C++ Syntax (Toggle Plain Text)
struct CarNode { char model; void displayModel() {cout << model;} CarNode * next; };
I need to make a stock which has a number of car types (Toyota, Mistubishi, etc..)
I should assign an initial value of how many cars I have ( Toyota 200, Mistubishi 100...)
Then when I sell for example 50 Toyotas and 20 Mistubishis It should be subtracted from
my stock, I also should be able to add new cars or add more Toyotas to my stock which will raise the number of the Toyotas I should also be able to add new models and set their prices...
Cal I achieve that by making a CarNode ? I'm really haveing a hard time thinking this though if theres no much trouble could you give me a code example ?
![]() |
Similar Threads
- c++ linked lists -file restoring (C++)
- Banking Project Help (C++)
- C++ Vs Java (C++)
- C++,relational database (C++)
- Need Developer: mysql and associated pages (Web Development Job Offers)
- Computer Science (IT Professionals' Lounge)
- database table design problems (Database Design)
- JSP and Oracle (JSP)
Other Threads in the C++ Forum
- Previous Thread: Class Inheritance - matching arguments
- Next Thread: Unknown syntax error in C++ class
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






