Help me please. I am having problems with my homework assignment. We are to create a product class that hold the item number, the name of the product, the number of units in stock, and the price of each unit. Here is my problem. I have written the program ( I use netbean) and I have encountered plenty of errors. The error messages that I get are as follows:
Here is what I have done so far. It would be great if there would be someone that would be able to help me throughout the next few weeks of assignments. Thanks
DonE
public class DVDInventory
{
//Inventory for DVD
import java.util.*;
import javax.swing.*;
import java.awt.event. *;
import java.awt.*;
class product comparable
{
String name; //class variable that stores item name
double number; //class variable that stores item number
long stockQuantity; //class variable that stores the quantity in stock
double price; //class variable that stores the items price
public product();
{
name = "";
number = 0.0;
stockQuantity = OL;
price = 0.0;
}
public product(String name,int number,long stockQuantity,d ouble price);
{
this.name = name
this.number = number;
this.stockQuant ity = stockQuantity;
this.price = price;
}
public void setItemName(Str ing name)
{
this.name = name;
}
public String getItemName()
{
return name;
}
public void setItemNumber(d ouble number)
{
this.number = number;
}
public double getItemNumber()
{
return number;
}
public void setstockQuantit y(long quantity)
{
stockQuantity = quantity;
}
public long getstockQuantit y()
{
stockQuantity = quantity;
}
public long get stockQuantity()
{
return stockQuantity;
}
public void setItemPrice(do uble price)
{
this.price = price;
}
public double getItemPrice()
{
return price;
}
public double calculateInvent oryValue()
{
return getItemPrice()* getStockQuantit y();
}
public StringtoString( )
{
return "\nName:"+getIt emName()+"\nNum ber:"+number"\n price:$"+price+
"\nQuantity:"+s tockQuantity+"\ nValue:$"+calcu latInventoryVal ue();
}//end product
class DVD(String name, int number, long stockQuantity, double price,
String titles)
private String titles;
public DVD()
{
super();//call constructor in product
titles = "";//add the additional attribute
}
Public DVD(String name, int number, long stockQuantity, double price,
String titles)
{
super(name, number, stockQuality, price); //call constructor in product
this.titles = titles; //add the additional attribute
}
public void settitle(String title)
{
this.titles = titles;
}
public string gettitles()
{
return titles;
}
public double calculateInvent oryValue()
{
return getItenPrice()* getstockQuantit y();
}
return "\nName:"+getIt emName()+"\nNum ber:"+getItemNu mber()+"\nPrice :$"
+getItemPrice() +"\nQuantity:"+ getstockQuantit y()+"\ntitles:"
gettitles()+"\n Value:$"+Calcul ateInventoryVal ue();
}}
}//end DVD
- illegal start type
- cannot find symbol
- operator cannot be applied
- assignment to itself
Here is what I have done so far. It would be great if there would be someone that would be able to help me throughout the next few weeks of assignments. Thanks
DonE
public class DVDInventory
{
//Inventory for DVD
import java.util.*;
import javax.swing.*;
import java.awt.event. *;
import java.awt.*;
class product comparable
{
String name; //class variable that stores item name
double number; //class variable that stores item number
long stockQuantity; //class variable that stores the quantity in stock
double price; //class variable that stores the items price
public product();
{
name = "";
number = 0.0;
stockQuantity = OL;
price = 0.0;
}
public product(String name,int number,long stockQuantity,d ouble price);
{
this.name = name
this.number = number;
this.stockQuant ity = stockQuantity;
this.price = price;
}
public void setItemName(Str ing name)
{
this.name = name;
}
public String getItemName()
{
return name;
}
public void setItemNumber(d ouble number)
{
this.number = number;
}
public double getItemNumber()
{
return number;
}
public void setstockQuantit y(long quantity)
{
stockQuantity = quantity;
}
public long getstockQuantit y()
{
stockQuantity = quantity;
}
public long get stockQuantity()
{
return stockQuantity;
}
public void setItemPrice(do uble price)
{
this.price = price;
}
public double getItemPrice()
{
return price;
}
public double calculateInvent oryValue()
{
return getItemPrice()* getStockQuantit y();
}
public StringtoString( )
{
return "\nName:"+getIt emName()+"\nNum ber:"+number"\n price:$"+price+
"\nQuantity:"+s tockQuantity+"\ nValue:$"+calcu latInventoryVal ue();
}//end product
class DVD(String name, int number, long stockQuantity, double price,
String titles)
private String titles;
public DVD()
{
super();//call constructor in product
titles = "";//add the additional attribute
}
Public DVD(String name, int number, long stockQuantity, double price,
String titles)
{
super(name, number, stockQuality, price); //call constructor in product
this.titles = titles; //add the additional attribute
}
public void settitle(String title)
{
this.titles = titles;
}
public string gettitles()
{
return titles;
}
public double calculateInvent oryValue()
{
return getItenPrice()* getstockQuantit y();
}
return "\nName:"+getIt emName()+"\nNum ber:"+getItemNu mber()+"\nPrice :$"
+getItemPrice() +"\nQuantity:"+ getstockQuantit y()+"\ntitles:"
gettitles()+"\n Value:$"+Calcul ateInventoryVal ue();
}}
}//end DVD
Comment