I have just been using a standard String to input and return information. I am trying to impliment an Array in to this inventory program so that I can store and view more than one item at a time.
I think I have done ok until I get to the Return part of the program. I have tried several different things but nothing seems to work.
As it is, I am getting a "cannot find symbol" error message on "cdName" in the return statment. Any help on what I am doing wrong?
public class Compactdisk
{// begin class
//InventoryCD class has 5 fields
String cdName[]; // cd name array
float price; // price of cd
int itemno; // item number of cd
int nstock; // how many units in stock
//Compact disk class constructor
public Compactdisk()
// 4 fields need to be set up
{
cdName = new String [25];
price = 0;
itemno = 0;
nstock = 0;
}
// set values
public void setCDName(String diskName)
{
cdName = cdName;
}
public void setPrice(float cdPrice)
{
price = cdPrice;
}
public void setItemno(int cdItemno)
{
itemno = cdItemno;
}
public void setNstock(int cdStock)
{
nstock = cdStock;
}
// return values
public String getCDName()
{
[B]return cdName();[/B]
}
public float getPrice()
{
return (price);
}
public int getItemno()
{
return (itemno);
}
public int getNstock()
{
return (nstock);
}
// returns inventory value
public float getValue()
{
return(price * nstock);
}
}// end class