// week6.MeritBadgeInventory.java //Tony Bailey, IT215.Java Programming /*/////////////////////////////////////////////////////////////////////////////////////////// / 1. Choose a Product that lends itself to an inventory (for example, products at your / workplace, office supplies, music CDs, DVD movies, or software). / 2. Create a Product class that holds: / Product number, name of the Product,number of units in stock, price of each unit. / 3. Create a Java application that displays: / Product number, name of the Product, number of units in stock, price of each unit / value of the inventory (the number of units in stock multiplied by the price of each unit) / 4. Modify the program so the application can handle multiple items. Use an array to store the items. / The output should display the information one product at a time, including the item number, / the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. / In addition, the output should display the value of the entire inventory. / Create a method to calculate the value of the entire inventory. / Create another method to sort the array items by the name of the product. / 5. Modify the Inventory Program by creating a subclass of the product class that uses one / additional unique feature of the product you chose. / In the subclass, create a method to calculate the value of the inventory of a product with / the same name as the method previously created for the product class. / The subclass method should also add a 5% restocking fee to the value of the inventory of that product. / Modify the output to display this additional feature you have chosen and the restocking fee. / 6. Modify the Inventory Program to use a GUI. The GUI should display the information one / product at a time, including the item number, the name of the product, the number of / units in stock, the price of each unit, and the value of the inventory of that product. / In addition, the GUI should display the value of the entire inventory, the additional attribute, / and the restocking fee. //*//////////////////////////////////////////////////////////////////////////////////////////// package badgegui; import javax.swing.JFrame; public class MeritBadgeInventory { public static void main( String[] args){ MeritBadge badge0 = new MeritBadge(0, "Field Sports", "Summer ", 5, .99, true);//pass arguments to constructor in meritbadge class MeritBadge badge1 = new MeritBadge(1, "Shooting Sports", "Summer ", 5, 1.49, true);//pass arguments to constructor in meritbadge class MeritBadge badge2 = new MeritBadge(2, "Water Sports ", "Summer ", 5, 2.49, true);//pass arguments to constructor in meritbadge class MeritBadge badge3 = new MeritBadge(3, "Citizenship ", "All Season", 5, 1.99, true);//pass arguments to constructor in meritbadge class MeritBadge badge4 = new MeritBadge(4, "Camping", "All Season", 5, 1.49, true);//pass arguments to constructor in meritbadge class ///show inventory MeritBadge MB = new MeritBadge(); JFrame frame = new JFrame("MeritBadge Inventory"); MB.setResizable(true); //set window to be un adjustable MB.showInventory();//Displays the unsorted inventory MB.displayImage();//displays the image chosen MB.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//set program to exit when window is closed with the "X" MB.setVisible(true); MB.setSize(600, 550);//set size of window } }