Question: You are tasked with writing a program that will keep track of items sold by a retail store. We are now going to add additional
You are tasked with writing a program that will keep track of items sold by a retail store.
We are now going to add additional types of products through the use of inheritance. In addition to the standard Product, there will be a Book and Food class, each with their own unique properties.
We will also need to keep track of the of the inventory or number of specific products available for sale for each item.
Requirements:
If a retail price is not supplied, the retail price should be set to a markup from the wholesale price.
The Food and Book items should inherit all the properties of the Product item
Foods cannot be added to the inventory without an expiration date.
Book will have an author property that should default to "Unknown"
Implement a toString method for Product, Food, and Book.
If the description for an item is not set, do not include it in the toString.
Add a property and methods to track the number of items in inventory for each item.
Negative inventory amounts are not allowed.
Add code to print any items that have an inventory amount less than
Grading details:
Correct usage of OOP concepts
Correct class design and usage of class instances
Correct implementation and usage of inheritance
Other supporting codelogic
Program runscorrect results
FormattingIndentation
Starter code:
public class RetailInventory
public static void mainString args
Product computer new ProductComputer;
computer.setStock;
Product Galaxy new ProductSamsung S "Samsung Phone with GB memory";
GalaxysetStock;
Product iPhone new ProductiPhone Plus", ;
iPhonesetStock;
Product headphones new ProductWireless Headphones", ;
headphones.setStock;
Product cBook new BookStarting out with C "Tony Gaddis";
cBook.setStock;
Product JavaBook new BookJava Java, Java: ObjectOriented Problem Solving", ;
JavaBook.setStock;
Product fujiApples new FoodFuji Apples", "Mar. ;
fujiApples.setStock;
Product gmCrackers new FoodGraham Crackers", "Apr. ;
gmCrackers.setStock;
Product inventory computer iPhone, Galaxy headphones, cBook, JavaBook, fujiApples, gmCrackers;
System.out.printlnViewing Store Products:";
System.out.println
;
for Product item: inventory
System.out.printlnitem;
System.out.printlnLow Stock Levels";
System.out.println
;
Add the code here to print Low Stock Levels
items with less then in inventory
Sample output:
Error: Starting out with C Negative stock levels not allowed.
Viewing Store Products:
Name: Computer, Wholesale: $ Retail: $ On Hand:
Name: iPhone Plus, Wholesale: $ Retail: $ On Hand:
Name: Samsung S Description: Samsung Phone with GB memory, Wholesale: $ Retail: $ On Hand:
Name: Wireless Headphones, Wholesale: $ Retail: $ On Hand:
Name: Starting out with C Wholesale: $ Retail: $ On Hand: Author: Tony Gaddis
Name: Java, Java, Java: ObjectOriented Problem Solving, Wholesale: $ Retail: $ On Hand: Author: Unknown
Name: Fuji Apple, Wholesale: $ Retail: $ On Hand: Expiration Date: Mar.
Name: Graham Crackers, Wholesale: $ Retail: $ On Hand: Expiration Date: Apr.
Low Stock Levels
Name: Computer, Wholesale: $ Retail: $ On Hand:
Name: Wireless Headphones, Wholesale: $ Retail: $ On Hand:
Name: Starting out with C Wholesale: $ Retail: $ On Hand: Author: Tony Gaddis
Process finished with exit code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
