So I've been reading much about object oriented programming and started this little program for practice, a Vending machine program.
I've got three classes here:
And this is what I have so far!
As far as I can tell, the VendingMachine Class is all good.
I'm at a lost with the other two classes below. (There are comments on the parts that I need help with)
If anyone could help guide me with this that would be much appreciated!
In this constructor you are passing in itemList, and then in the first line you are overwriting with an empty list. That should be your first hint that it's not correct. I believe you are wanting to add all items in the itemList to the "items" field.
I think a better name for your VendingMachine class would be "Item" based on how you use it to create a list of "items". Naming consistency is important.