View Single Post
  #13  
Old July 24th, 2009, 03:05 AM
hEad's Avatar

hEad hEad is offline
Sergeant
 
Join Date: Dec 2007
Location: WA, Australia
Posts: 228
Thanks: 18
Thanked 7 Times in 5 Posts
hEad is on a distinguished road
Default Re: O.T Help sought from Java Programmers

I really want to that you all for your help. I am studying for my degree correspondence because I'm a small town country hick - up to this point I have found external studies suits me fine, but for this unit... someone on hand to converse with is certainly missed.

I have finished the student class (I think) taking onboard your suggestions - public to private, inversion of assignments etc. I know I should get onto the main(), but needed a small win for some confidence, so Student class needed completion.

I still don't know the why and what of get and set methods, but I believe this will become apparent when I start fiddling with the array.


public class Student {

private String studentID;
private String firstName;
private String lastName;
private String gender;
private String dateOfBirth;
private String phoneNumber;
private String yearCommenced;

//Constructor
public Student(String sId, String fn, String ln, String sex, String dOB, String pn, String yc){

studentID = sId;
firstName = fn;
lastName = ln;
gender = sex;
dateOfBirth = dOB;
phoneNumber = pn;
yearCommenced = yc;
}
//Get methods
public String getStudentID(){
return studentID;
}
public String getFirstName(){
return firstName;
}
public String getLastName(){
return lastName;
}
public String getGender(){
return gender;
}
public String getDateOfBirth(){
return dateOfBirth;
}
public String getPhoneNumber(){
return phoneNumber;
}
public String getYearCommenced(){
return yearCommenced;
}
//set methods for data fields

public void setStudentID(String sId){
studentID = sId;
}
public void setFirstName(String fn){
firstName = fn;
}
public void setLastName(String ln){
lastName = ln;
}
public void setGender(String sex){
gender = sex;
}
public void setDateOfBirth(String dOB){
dateOfBirth = dOB;
}
public void setPhoneNumber(String pn){
phoneNumber = pn;
}
public void setYearCommenced(String yc){
yearCommenced = yc;
}
}

In the ball park?
Reply With Quote