Question: using java creat : - Class Item that defines an item in terms of its ID, name, price and quantity. Include the following for this

using java creat :

- Class Item that defines an item in terms of its ID, name, price and quantity. Include the following for this class:

o A constructor to initialize an item data

o Get methods for all item data

o Set methods for all item data

o toString method that returns an Item object information as shown in the sample run.

o Item class should implement interface Measurable

o Item class should implement interface Comparable

- Class Shop that maintains a shop catalog as an array of Items, catalog capacity and catalog current size. Include the following for this class:

o A constructor to construct the catalog array for a given capacity, and initialize the capacity and the current size.

o A method to add an item to the catalog given item information(i.e.id, name,price,quantity)

o A method to add get an item in the catalog given its index.

o A method to get the most expensive item using method Data.max().

o A method to get the cheapest item using method Data.min().

o A method to sort catalog items using Arrays.sort().

o toString method that returns an Item object information as shown in the sample run.

o A method that returns the capacity of the catalog

o A method that returns the size of the catalog

o A method that returns a boolean value indicating if the catalog is full or not

. - Class GiftShop application that creates a Shop object, prompts the user to enter item information and add them to the shop object. Then it prints the current items in the shop catalog in a sorted form. It also prints the most expensive item and the cheapest item. (See the sample run)

using java creat : - Class Item that defines an item in

Sample Run: Enter item code, -1 to stop:c01 Enter item name:Large Mug Enter tem price:0.9 Enter item quantity:60 Enter item code, -1 to stop:c02 Enter item name: T Shirt Enter item price:12 Enter item quantity:40 Enter item code, -1 to stop:c03 Enter item name: Flash Enter item price:8 Enter item quantity: 100 Enter item code, -1 to stop:-1 Gift Shop Current Items: code:c02 name:T Shirt price: 12.000 quantity:40 code:c03 name:Flash price:8.000 quantity: 100 code:c01 name:Large Mug price:0.900 quantity:60 The most expensive item: code:c02 name:T Shirt price: 12.000 quantity:40 The cheapest item: code:c01 name:Large Mug price:0.900 quantity:60 Large Stock Items code:c03 name:Flash price:8.000 quantity: 100 code:c01 name:Large Mug price:0.900

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!