Question: Consider the following interface: interface InventoryItem { // Return the quantity of that item currently in stock. public int getQuantity(); // Get the price of

 Consider the following interface: interface InventoryItem { // Return the quantity

Consider the following interface: interface InventoryItem { // Return the quantity of that item currently in stock. public int getQuantity(); // Get the price of an individual of an item. public double getRetailPrice(); // Change the quantity of an item absolutely. public void setQuantity(int qty); // Adjust the retail price of an item public void setRetailPrice(double price); } The idea here is to pretend that you are creating a very simple inventory system for a friend who is opening a new store. Write at least two object classes representing card games and comic books that implement this interface. Each item type should have data fields that define the quantity of the item in stock and the per-unit price of that item. A card game should also have a simple description data field while a comic book should have a title and an issue. Write appropriate constructors, toStrings, and any missing accessors or mutators for your classes. Write an application class called InventoryTracker that demonstrates your inventory objects. Create (hard-code) several different items of each type and store them in a single array. Show that you can print their state using toString. Also show that you can use a polymorphic loop to determine the total inventory quantity (total number of items), total inventory value as well as the most and least valuable inventory items in the store (value is the quantity x the retail price). Creating a store inventory array of 5 items... Stocking the inventory items... Printing store inventory: Comic Book [ Superman, Issue 2, Retail Price: 100.0, Qty in Stock: 2] Card Game [ Uno, Retail Price: 9.95, Qty in Stock: 3] Card Game [ Munchkin, Retail Price: 29.95, Qty in Stock: 10] Comic Book [ Buffy the Vampire Slayer, Issue 6, Retail Price: 9.95, Qty in Stock: 2] Comic Book [ X-men, Issue 50, Retail Price: 8.95, Qty in Stock: 12] Assessing value of in-stock items ... Total Inventory Quantity (num items):29 Total Inventory Value:656.65 Inventory Item with Max Value of 299.5 is: Card Game [ Munchkin, Retail Price: 29.95, Qty in Stock: 10] Inventory Item with Min Value of 19.9 is: Comic Book [ Buffy the Vampire Slayer, Issue 6, Retail Price: 9.95, Qty in Stock: 2] After you have accomplished the work above, change your tester so that it allows the user to enter the inventory items instead of hard-coding them. Your tester: Prompts the user for the size of the array Uses a loop to prompt the user for each item in the array Prompt the user for the type of item and then the necessary data to construct the item Then run the remainder of the program as shown above

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!