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.

  1. Implement the Warehouse-system class, Storage, with the following requirements:

  1. Create two attributes, storageName, and numberOfItems
  2. Create a constructor to initialize the storageName with empty string, and numberOfItems with 0.
  3. Create a setter method to set the storageName attribute to a specific value.
  4. Create a setter method to set the numberOfItems attribute to a specific value
  5. Create a getter method to return the value of storageName attribute.
  6. Create a getter method to return the value of numberOfItems attribute.
  7. Create two methods addItem() and removeItem() to increase or decrease number of items.

  1. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!