?
2012-04-16 19:50:55 UTC
Classes are below
public class Database {
private Entry [] array;
private int count;
public Database(){
array = new Entry[100];
count = 0;
}
public void add(Entry item){
array[count] = item;
count++;
}
public Entry findNumber(String number){
for (int i = 0; i < count; i++)
{
if (array[i].getTelephone().equals(number))
return array[i];
}
return null;
}
public Entry findName(String name){
for (int j = 0; j < count; j++){
if (array[j].getName().equals(name))
return array[j];
}
return null;
}
public String toString(){
???????????????????????
}
}
public class Entry {
private String name;
private String address;
private String telephone;
public Entry(String name, String address, String telephone) {
this.name = name;
this.address = address;
this.telephone = telephone;
}//end constructor
public String getName(){
return name;
}
public String getAddress(){
return address;
}
public String getTelephone(){
return telephone;
}
public void setName(String name){
this.name = name;
}
public void setAddress(String address){
this.address = address;
}
public void setTelephone(String telephone){
this.telephone = telephone;
}
public String toString(){
return name + ": " + address + ": " + telephone;
}
}