Question: Write a Java Program to demonstrate the working of a Storage-system, where we can add and remove items from/to a storage. Implement the Warehouse-system class,
Write a Java Program to demonstrate the working of a Storage-system, where we can add and remove items from/to a storage.
- Implement the Warehouse-system class, Storage, with the following requirements:
- Create two attributes, storageName, and numberOfItems
- Create a constructor to initialize the storageName with empty string, and numberOfItems with 0.
- Create a setter method to set the storageName attribute to a specific value.
- Create a setter method to set the numberOfItems attribute to a specific value
- Create a getter method to return the value of storageName attribute.
- Create a getter method to return the value of numberOfItems attribute.
- Create two methods addItem() and removeItem() to increase or decrease number of items.
- Test the Storage class and its constructor and methods by implementing a tester class, StorageTester.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
