Search This Blog

Wednesday, June 29, 2011

Code Help Please

Hello. I am working on a little Java project and have gotten a little stuck. May I have a little help please? First the original class and then the test class code here. Thanks!!





public class PhoneBookEntry {

private String name;
private String number;

PhoneBookEntry(String string, String string2 ){

}
public void setName (String phoneName){
name = phoneName;
}
public String getName (){
return name;
}
public void setNumber(String phoneNumber){
number = phoneNumber;
}
public String getNumber(){
return number;
}
public static void add(PhoneBookEntry phoneBookEntry) {
// TODO Auto-generated method stub

}
}







import java.util.Scanner;import java.util.ArrayList;
public class TestPhoneBookEntry {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

ArrayList PhoneBookEntry = new ArrayList();

PhoneBookEntry.add(new PhoneBookEntry("Peter", "0123456"));
PhoneBookEntry.add(new PhoneBookEntry("Mike", "0123457"));
PhoneBookEntry.add(new PhoneBookEntry("David", "0125456"));
PhoneBookEntry.add(new PhoneBookEntry("Tom", "0123456"));
PhoneBookEntry.add(new PhoneBookEntry("Mark", "0523456"));
for (int index = 0; index < PhoneBookEntry.size(); index++)
System.out.println(PhoneBookEntry.get(index));

}

}



http://bit.ly/lqZODl

No comments:

Post a Comment