Implement the following class in Java:
Item - id: int - itemCount: int - name: String - UPC: int + Item() + Item (String name, int UPC) + getID(): int + getName(): String + getUPC(): int + setName(String type): void + setUPC(int UPC): void This class implements items that can be stored in a warehouse. Every item has an ID that is assigned by the class in an orderly fashion (1, 2, 3, 4, …). Item’s name can contain any string assigned by the user (e.g. Dell computer, MS mouse, etc.) UPC is a unique identification number (for example: 4011200296908). Attributes: id An auto incremental ID where the first item has the id=1 itemCount A static variable that holds the number of created objects Name Name of the item UPC A unique identification number Methods: Item() A default constructor Item (String name, int UPC) A constructor that takes the name and UPC of an item. It should assign an id to each item, and increments the itemCount everytime getID(): int An accessor for the attribute id getName(): String An accessor for the attribute name getUPC(): int An accessor for the attribute UPC setName(String type): void A setter for attribute name setUPC(int UPC): void A setter for attribute UPC
Implement the following class in Java: (13 Marks) Warehouse - items: Item[] - nOfItems: int + Warehouse(int maxSize) + addItem(String name, int UPC): void + deleteItem(int UPC): void + searchItem(int UPC): int + sort(): void + printItemsInfo(): void + getNumberOfItems(): int + isFull(): boolean + isEmpty(): boolean Attributes: items An array of the object Item (from the previous Question) nOfItems The number of the items in the array. Methods: Warehouse(int maxSize) A constructor that accepts the max number of items in the warehouse + addItem(String name, int UPC): void To add a new item. If the item’s UPC exists in the system, the method should not add the item + deleteItem(int UPC): void To delete an item from the warehouse using its given UPC + searchItem(int UPC): int To search for an item using its UPC. The method should return the index of the item in the array, and -1 if not found. + sort(): void To sort the items in an ascending order (smallest to the largest) using their UPC + printItemsInfo(): void To print all items information in the system. For each, it should print: id, name, and UPC. Then it should print the number of items in the warehouse. + getNumberOfItems(): int To return the number of items in the warehouse + isFull(): boolean Return true if the array of items is full + isEmpty(): boolean Return true if the array of items is empty
Using the previous implemented classes, implement a main program that does the following tasks (assume that the max size of items=100): (5 Marks) 1) Add the following items to the warehouse Name UPC HP computer 122 Desk 100 Chair 15 Tablet 200 Pen 100 2) Sort the items based on their UPC number in an ascending order 3) Print all items information 4) Delete the item which has (UPC=100) 5) Print all items information
Using the previously mentioned main method that you have implemented, write in the box the output expected from your main method.