This is my code for an assignment that was due yesterday. I have to create a class that holds information of an item that lends it self to inventory. Then cerate an application that displays the information. This is my code. It compiles fine but upon running it , I get this error message: "exception in thread "main" java.lang.nosuch error method:". I know that I need a main method like "public static void main(Sting [] args). But no matter where I put it, i get the same error. I would appreciate any assistance. thank you.
java
public class DVD{
private String name;
private int itemNumber;
private int stockQuantity;
private double price;
public DVD(String name, int itemNumber, int stockQuantity, double price){
this.name = name;
this.itemNumber = itemNumber;
this.stockQuantity = stockQuantity;
this.price = price;
}
public String toString(){
return "DVD Title: " + this.name + "\n" +
"Item Number: " + this.itemNumber + "\n" +
"Stock Quantity: " + this.stockQuantity + "\n" +
"Price: " + this.price + "\n";
}
public String getName(){
return this.name;
}
public void setName(String name){
this.name = name;
}
public int getItemNumber(){
return this.itemNumber;
}
public void setItemNumber(int itemNumber){
this.itemNumber = itemNumber;
}
public int getStockQuantity(){
return this.stockQuantity;
}
public void setStockQuantity(int stockQuantity){
this.stockQuantity = stockQuantity;
}
public double getPrice(){
return this.price;
}
public void setPrice(double price){
this.price = price;
}
}
*edit: Please use code tags in the future, thanks!
This post has been edited by Martyr2: 2 Aug, 2008 - 09:47 AM