Hi Friends,
I'm afraid I need help again.... I wrote this program, and it won't compile...and now I have to add to it.
Here is the program:
public class InventoryProgram1App {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("InventoryProgram1App");
{
{public class DVD(); }
double restockFee = 0.05;
DVD a = new DVD("Family","PG",restockFee, 1,"Annie");
DVD b = new DVD("Comedy","PG-13", restockFee, 2, "My Best Friend's Wedding");
DVD c = new DVD("Comedy","PG-13", restockFee, 3, "The Wedding Planner");
DVD d = new DVD("Drama","PG-13",restockFee, 4, "Save the Last Dance");
ShowInventory();
{ setDefaultCloseOperation(); //EXITONCLOSE();
{ setVisible("true");
{ setSize ("410, 380");
}
}
{public class Inventory.java
{
public static void main( String args[] )
{
int productNum[] = { 1 };
String productName = "The Devil Wears Prada";
int productUnits = 20;
double productPrice = 19.99;
double productValue;
productValue = productUnits * productPrice;
System.out.printf( "\nProduct number: " );
for ( int counter = 0 ; counter < productNum.length; counter++ )
System.out.println( productNum[ counter ] = 1 + counter );
System.out.printf( "ProductName: " );
System.out.println( productName );
System.out.printf( "Units: " );
System.out.println( productUnits );
System.out.printf( "Price: \u0024" );
System.out.println( productPrice );
System.out.printf( "Value: \u0024" );
System.out.println( productValue );
System.out.printf( "\n" );
{
}
And here is what I have to do to it:
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'm totally lost -- again....can you please help me?