![]() |
|
#1
|
|||
|
|||
Linked Lists Database...Hello Everyone.
Project outline: Quote:
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. |
|||
|
#2
|
||||
|
||||
Re: Linked Lists Database...Just a quick question before I can help you: how long have you been programming using C++?
|
|
#3
|
|||
|
|||
Re: Linked Lists Database...1 Year now...
|
|
#4
|
||||
|
||||
Re: Linked Lists Database...Great! then you should know about member functions. what I would suggest is instead of having a class that just does the add/subtract transactions is have those in the transaction class. also, can you use your own header files? does/can this be modular or does it have to remain in the same file?
|
|
#5
|
|||
|
|||
Re: Linked Lists Database...So If i wanted to do a Stock of car models for the Distributor I should make a Car Node ?
CPP / C++ / C Code:
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 ? Last edited by admin : 18-Mar-2008 at 04:32.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|
#6
|
||||
|
||||
Re: Linked Lists Database...That's a start, but you really should declare the model as a string. When you declare it as a char that, generally, only allows you to store a single character into the variable. With a string, you can include the entire name. Also, as a part of it you should include a variable that stores the number of cars available. Or if you wanted you could declare another struct that includes the number of cars available (but I think this would be a bit too complicated) Also, I believe you stated that you need to store the price of that model, so I would suggest another variable that stores that price.
So, here's what I suggest: CPP / C++ / C Code:
So, now that you have your carNode, you can create other classes or structs that'll change the amount of cars you have. I hope this helps. |
|
#7
|
|||
|
|||
Re: Linked Lists Database...Why u use struct instead of class since class is private by default and struct is public buy default ?
This is not a good OOP design principles. |
|
#8
|
||||
|
||||
Re: Linked Lists Database...Quote:
True, but it really doesn't matter since you can make any part of a struct or class private or public. It depends on what the programmer is comfortable using. I just suggested a struct because that was what the original design. By the way, TS3BxL, you never answered me: can you create your own header files and modules or does this have to be in a single file? |
|
#9
|
|||
|
|||
Re: Linked Lists Database...Quote:
my bad, Yes you can create your own header files and modules... |
|
#10
|
||||
|
||||
Re: Linked Lists Database...do you need anymore help at the moment?
|
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linked Lists advice request | promsan | C Programming Language | 74 | 23-May-2007 08:29 |
| Linked Lists problem | kracivi | C Programming Language | 1 | 01-May-2007 08:40 |
| Doubly linked lists in C++ | sweeeeeeetlipss | C++ Forum | 1 | 23-Oct-2006 23:27 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| Linked lists | vortz83 | C++ Forum | 3 | 20-Mar-2004 06:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The