Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started