I have to create a database that implements an array that stores a persons first name and last name and zip code
this is what i have so far for my individuals array
public class IndividualsArray
{
private Individuals[] array;
private int count;
private int zipCode;
public IndividualsArray ()
{
array = new Individuals[5];
count = 0;
zipCode = 00000;
}
public void addIndividuals (String fName, String lName, int zipCode)
{
if (count == array.length)
increaseSize();
array[count] = new Individuals (fName, lName, zipCode);
zipCode = zipCode;
count++;
}
public String toString()
{
String database;
database += "A List of Individuals\n";
database += "First Name: " + fName + "\n";
database += "Last Name: " + lName + "\n";
database += "Zip Code: " + zipCode + "\n";
database += "n\nIndividuals Run Down:\n\n";
for (int individuals = 0; individuals < count; individuals++)
database += array[individuals].toString() + "\n";
return database;
}
public void increaseSize ()
{
Individuals[] temp = new Individuals[array.length * 3];
for (int individuals = 0; individuals < array.length; individuals++)
temp[individuals] = array[individuals];
array = temp;
}
}
i get an error msg at these lines:
database += "First Name: " + fName + "\n";
database += "Last Name: " + lName + "\n";
saying
IndividualsArray.java:33: cannot find symbol
symbol : variable fName
location: class IndividualsArray
database += "First Name: " + fName + "\n";
^
IndividualsArray.java:34: cannot find symbol
symbol : variable lName
location: class IndividualsArray
database += "Last Name: " + lName + "\n";
^
can someone please lend a helping hand......
thank you