Program requirements are as follows:
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 can not understand why I am getting and error in the beginning where it says "Public Static ....." the program comes up with and error that causes the program to terminate.. What am I doing wrong? Can some one please help point me in the direction I need to go....Thank
public class InventoryProgram2
{
public static void main(String args []);
{
DVD dvd;
dvd = new DVD("A Haunting in Conneticut", 4, 19.99, 685);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is" + dvd.getDvdStock());
System.out.println("The price of each DVD is" + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is" + dvd.value());
dvd = new DVD ("The Rose", 8, 19.98, 565);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is" + dvd.getDvdStock());
System.out.println("The price of each DVD is" + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is" + dvd.value());
dvd = new DVD ("Goodfellas", 10, 19.99,785);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is" + dvd.getDvdStock());
System.out.println("The price of each DVD is" + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is" + dvd.value());
dvd = new DVD ("Twilight",8,18.56,578);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is" + dvd.getDvdStock());
System.out.println("The price of each DVD is" + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is" + dvd.value());
}//end class main
} // end class InventoryProgram2
class DVD {
private String dvdTitle;
private double dvdStock;
private double dvdPrice;
private double dvdItem;
public DVD(String title, int stock, double price, double item) {
dvdTitle = title;
dvdStock = stock;
dvdPrice = price;
dvdItem = item;
} //end four-argument constructor
public void setDvdTitle(String title) {
dvdTitle = title;
} //end method setDvdTitle
//return DVD Title
public String getDvdTitle() {
return dvdTitle;
} //end method getDvdTitle
//set DVD Stock
public void setDvdStock(double stock) {
dvdStock = stock;
} //end method setDvdStock
//return DvdStock
public double getDvdStock() {
return dvdStock;
} //end method get Dvdstock
public void setDvdPrice(double price) {
dvdPrice = price;
} //end method setDvdPrice
//return dvdPrice
public double getDvdPrice() {
return dvdPrice;
} //end method get Dvd Price
public void setDvdItem(double item) {
dvdItem = item;
} //end method setdvdItem
//return DVD item
public double getDvdItem() {
return dvdItem;
} //end method getDvdItem
//calculate <strong class="highlight">inventory</strong> value
public double value() {
return dvdPrice * dvdStock;
} //end method value
} //end class DVD
class Inventory {
DVD movies[] = new DVD[100];
// Add to inventory
public void addToInventory(DVD movie) {
}
// Get inventory value
public double getInventoryValue() {
Inventory myInventory = new Inventory();
myInventory.addToInventory(new DVD("Dawn of the Dead", 25, 14.95, 68));
// Print out the inventory total value
System.out.println("Total value of inventory is: " + myInventory.getInventoryValue());
return myInventory.getInventoryValue();
}
}