❔ Using linked lists to create an inventory management system
Hi all, for my uni course, I need to create an inventory management system for an assortment of tools to be displayed, hired out, and returned. I need to have the items sorted into categories, and I am unable to use third-party libraries or data structures outside of the course. The thing I am struggling with how do I use the categories we have been given (gardening tools, flooring tools, etc) to create essentially isolated groups that are all searched through. My thinking is in the attached (poorly drawn) picture. But I don't know how to even start to code this, or am I approaching it incorrectly? I would like to use a binary tree in the program so that I can use the binary search method - but this isn't compulsory. I have the class for the individual tools set up, but I don't know if what I am thinking is possible. Thanks for your help.
4 Replies
A Hashtable (Dictonary) might be a better choice. You can use the category as the dictionary key and the list of items matching that category as the value.
In a real world implementation of such an inventory system you would likely model it as a relational database with things like many-to-many relationships between items and categories (for instance, an item could belong to more than one category) and you might have things like sub-categories (parent / child relationships between categories)...
...but I imagine for the course you are taking you are being asked to solve a much simpler version of this problem.
Hmm, we haven't explicitly been taught about those in this unit. Therefore, I can't use anything we haven't been taught. Yeah I can see how to do it in a real world scenario, but this course is limiting us quite a lot. I think I came up with a solution though. I am just going to have a fourth piece of info on the tools, which is the category, and then when it searches that, I will just accept those that match the search criteria. e.g., if someone searches for gardening tools, it will only show those items. Thanks for your help though
Good luck 🙂
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.