Hash Map Inventory

1.    The HashMap inventory<String, Product has already been declared, where Product has key attribute barcode which is of type String. The method getbarcode() is in Product. The variable p has already been declared and all attributes have already been entered. Write the java code to insert p into inventory


2.    Prompt the user for a barcode and retrieve the product from the hashMap inventory.



3.    Write a piece of code that prints out the names and barcodes of the objects in inventory.



4.    Write a comparator class that compares Products by price



5.    Declare a priority queue that uses the comparator class in number 3 to compare Products.
 
Powered by