Inventory Program Part 2 of 6
O.k to begin with Inventory Program Part 1 we were to chose a product that lends itself to an inventory ( for example, products at your workplace, office supplies, music CDs, DVD movies, or software) Create a product class that holds the itme number, the name of the product, the number of units in stock, and the price of each unit. Create a Java application that displays the product number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory (the number of units in stock multiplied by the price of each unit). Pay attention to the good programming practices in the text to ensure your source code is readable and well documented. Post as attachment in java format.
I know no one has the same reading material as me so just skip that part. By accident I think I turned in to the teacher Part 2 instead of part one.
And part 2 Modify the Inventory 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.
I will post the code which does work. I would like for someone who knows Java to be able to tell me whether this application applies to both parts one and two or just one or two. If this is at all possible. OK here goes:
// Inventory Program
import static java.lang.Math.*;
public class cdinventory
public static class cd
public cd (String cdnum, String cdname, int numinstock, double cdprice, double totalvalue)
}//end constructor public cd
public static class cdartist
public double artistinventory;
}//end subclass cd
public static void main(String args)
cd cdcollection = new cd ;
// prompt user to enter cdname
String cdname =
JOptionPane.showInputDialog("Enter CD name or quit to quit: ");
// create the message
String message =
String.format("The CD name is: ", cdname);
// display the message to welcome the user by name
JOptionPane.showMessageDialog( null, message );
}//end method main
}//end class cdinventory