An Interface called IContainer items that implement IContainer can have other things put inside them Add method adds an item to the container. TotalCount property returns how many items are in the container including any containers inside. calculate the totalCount recursively. TotalWeight property returns the total weight of the container including any containers inside. calculate the totalWeight recursively when this method is called. A class called Inventory that implements IContainer The constructor should pass in the number of items in the inventory. An abstract base class called Item Each item should have a cost and a weight property Several inherited objects from a typical RPG. Each item should have a different cost and weight A BagOfHolding class which inherits from Item and implements IContainer You should write some test code to test all of your classes. For example, it might look something like this. Make sure that you test the recursive TotalCount and TotalWeight methods
Inventory inventory = new Inventory(4); inventory.Add(new Sword(20, 30)); inventory.Add(new HealthPotion(10, 5)); inventory.Add(new BagOfHolding(1, 5)); var bagOfHolding = inventory.items[2]; bagOfHolding.Add(new Sword(10, 20)); bagOfHolding.Add(new Sword(10, 20)); bagOfHolding.Add(new Sword(10, 20)); int totalCount = inventory.TotalCount; int totalWeight = inventory.TotalWeight;