Project does not produce all results (Arraylist)

When I run this project I get no errors but the some of the results don't show up

Why?

Here is my code..

class PersonClass{

private String empid;

private String lname;

private String fname;

private String street;

private String city;

private String state;

private String zip;

privatedouble payrate;

privateint yearsworked;

public PersonClass(String id){

empid = id;

}

public PersonClass(String id, String ln, String fn, String st, String ct, String se, String zp,double pr,int yw){

empid = id;

lname = ln;

fname = fn;

street = st;

city = ct;

state = se;

zip = zp;

payrate = pr;

yearsworked = yw;

}

// accessors

public String getID(){return empid;}

public String getFname(){return fname;}

public String getLname(){return lname;}

public String getStree(){return street;}

public String getCity(){return city;}

public String getState(){return state;}

public String getZip(){return zip;}

publicdouble getPayrate(){return payrate;}

publicint getYearsworked(){return yearsworked;}

}

publicclass JavaSampleSixA{

static ArrayList<PersonClass> arlist;

static Scanner kbd;

publicstatic PersonClass makePerson(){

PersonClass temp =null;

// prompt for data

String id;

String ln;

String fn;

String st;

String se;

String ct;

String zp;

double pr;

int years;

System.out.print("Enter ID Number ==>");

id = kbd.next();

System.out.print("Enter Last Name ==>");

ln = kbd.next();

System.out.print("Enter First Name ==>");

fn = kbd.next();

System.out.print("Enter the address==>");

st = kbd.next();

System.out.print("Enter City ==>");

ct = kbd.next();

System.out.print("Enter State ==>");

se = kbd.next();

System.out.print("Enter Zip ==>");

zp = kbd.next();

System.out.print("Enter payrate as double ==>");

pr = kbd.nextDouble();

System.out.print("Enter years worked ==>");

years = kbd.nextInt();

// make an object

temp =new PersonClass(id, ln,fn,st,ct,se, zp, pr,years);

return temp;

}

public PersonClass findPerson(){

PersonClass temp =null;

// prompt for data

String id;

System.out.print("Enter Employee Id ==>");

id = kbd.next();

return temp;

}

publicstaticvoid main(String[] args){

// make array list object

arlist =new ArrayList<PersonClass>();

// make a scanner

kbd =new Scanner(System.in);

// create people until select stop

boolean endData =false;

while (!endData){

PersonClass temp = makePerson();

arlist.add(temp);

System.out.println("More (Y/N)-->");

String ans = kbd.next();

if (ans.equalsIgnoreCase("N")){

endData =true;

}

}

// print out all elements of array list

for (PersonClass idx : arlist){

System.out.printf("Employee Id is \n", idx.getID());

System.out.printf("Name is %s - %s \n", idx.getFname(),idx.getLname());

System.out.printf("Street is \n", idx.getStree());

System.out.printf("City is \n", idx.getCity());

System.out.printf("State is \n", idx.getState());

System.out.printf("Zip Code is \n", idx.getZip());

System.out.printf("Payrate is %8.2f\n", idx.getPayrate());

System.out.printf("Years worked are %d\n", idx.getYearsworked());

System.out.println("--");

}

}

}

PS still working on one section called public PersonClass findPerson() so don't look at that please.

sandy

PS it prints out only 3 of the results.

[7712 byte] By [SandyReda] at [2007-11-27 3:45:36]
# 1
3 of what results? 3 of the PersonClass object you add, or 3 of the member vairables of each PersonClass? What input did you give it?
hunter9000a at 2007-7-12 8:49:19 > top of Java-index,Java Essentials,New To Java...
# 2

Here's an example of output problems:

System.out.printf("City is \n", idx.getCity());

You should have written

System.out.printf("City is %s\n", idx.getCity());

And, by the way, %n is preferred over \n -- it will be platform independent:

System.out.printf("City is %s%n", idx.getCity());

DrLaszloJamfa at 2007-7-12 8:49:19 > top of Java-index,Java Essentials,New To Java...
# 3
Thanks Dr. I must have looked at that 8 times and did not see it, sandyR
SandyReda at 2007-7-12 8:49:19 > top of Java-index,Java Essentials,New To Java...