Inheritance and program structure planning please help a newbie
Hello all, I've been away from programming a good few years and am back in school now trying to picked up where I left off. I'm currently in a C++ data structures class, and we're learning about classes and inheritance. Needless to say, these last 2 weeks have been spent reading 100's of pages trying to get up-to-date and rejog my memory. Here's my current challenge:
I'm to design an energy conservation program which allows the user to keep track of various technologies (categories) which each have a certain number of devices within each technology category.
For instance, the database always starts out empty. The user has the option to add a new technology through the client. So the user adds the technologies 'Solar' and 'Gas' seperately, and then returns to the main menu and chooses the 'add a device using a particular technology' option.
Then, for example, they select the 'Solar' category, and add the devices 'CBR 400' and 'YXT 9B' to the Solar category, each with an efficiency rating of 200.4 and 173.3 respectively.
They keep continuing to add/remove various technogies/and or devices in this same order.
Now, here's my main concern...is the class implementations.
Here's a list of the data needed to be kept track of (really pretty simple):
Devices: (name, efficiency rating)
Here's the important part...the user can select a menu option that displays all the devices in their sorted efficiency rating, from greatest to least (higher the efficiency rating, the closer to the head of the list it will be placed). So in essence, you want the program to be able to display all the devices (devoid of their technological categories) with their efficiency ratings sorted.
If I'm using single inheritance, how should I go about doing this?
We are to keep track of the technologies and devices as an array of trees, which I'm assuming means each technology will be the head of a tree and its devices are its branches, with multiple technologies (trees) being sequentially linked by an array with indexing. But what classes should I use and how should they all relate?
I'm not sure if I should make 'Technology' class, because all it does is hold the name of the technology to be created, and then make a 'Device' class an inherited class of technology, with two pieces of info (name and efficiency rating). But technically, would a device have an 'is a' relationship with a technology? It doesn't seem right that a 'CBR 400' 'is a' 'Solar.' Or maybe I'm just looking too hard into this.
I know I'll need some way to store the nodes represented by each device for a double linked list, so should I have a Linked List class with a Node class derived from it? I'm just really struggling with the design portion of this. I already know I'll need public functions for 'add_technology', 'remove_technology (which consequently will also delete every device in its category)', as well as 'add_device' and 'remove_device' and 'sort_device' (sort it into the list as each object is added) as well as 'display_devices.'
I'm just really confused as to how to start tackling this. Any help would be greatly appreciated as to how you guys would go about doing this single inheritance program efficiently. Not asking for code, just how you would structure your classes and/or functions and/or structs. Any psuedo bone structure code would be awesome. I just want to begin tackling this program :( Thanks a bunch