Here is what i did, But i think i did the set and get methods wrong so if u can
ID: 3619501 • Letter: H
Question
Here is what i did, But i think i did the set and get methods wrong so if u can help me correct it, Thanks!class Address {
String firstName;
String lastName;
String streetAddress;
String city;
String province;
String postalCode;
String counrty;
String phoneNumber;
String emailAddress;
public Address() {
this.firstName = "UNKNOWN";
this.lastName = "UNKNOWN";
this.streetAddress = "UNKNOWN";
this.city = "UNKNOWN";
this.province = "UNKNOWN";
this.postalCode = "UNKNOWN";
this.counrty = "UNKNOWN";
this.phoneNumber = "UNKNOWN";
this.emailAddress = "UNKNOWN";
}
public void setfirstName(String fN){
firstName = fN;
}
public void setlastName(String lN){
lastName = lN;
}
public void setstreetAddress(String sA){
streetAddress = sA;
}
public void setcity(String c){
city = c;
}
public void setprovince(String p){
province = p;
}
public void setpostalCode(String pC){
postalCode = pC;
}
public void setcounrty(String cc){
counrty = cc;
}
public void setphoneNumber(String pN){
phoneNumber = pN;
}
public void setemailAddress(String eA){
emailAddress = eA;
}
public String getfirstName(){
return firstName;
}
public String getlastName(){
return lastName;
}
public String getstreetAddress(){
return streetAddress;
}
public String getcity(){
return city;
}
public String getprovince(){
return province;
}
public String getpostalCode(){
return postalCode;
}
public String getcounrty(){
return counrty;
}
public String getphoneNumber(){
return phoneNumber;
}
public String getemailAddress(){
return emailAddress;
}
public String toString(){
return String.format("%s %s %s %s, %s %s %s " + "Tel.:" + "%s " + "E-mail:" + "%s", getfirstName(), getlastName(), getstreetAddress(), getcity(), getprovince(), getpostalCode(), getcounrty(), getphoneNumber(), getemailAddress());
}
}
Explanation / Answer
I do not see ANYTHING wrong with your code -- it should work. What problems are you finding? How are you running this program? Do you have a separate class to test if this class works?