Everyone,
Would appreciate some advice on how to implement the homework assignment in
the Main class, provided I handled the assignment correctly in the other
files.
I am probably overthinking this and making it harder that it has to be.
Person.java looks like
package mypersoninterfaceproject;
public class Person implements MyOwnInterface {
String firstName;
String lastName;
int streetNumber;
String streetName;
String country;
AddressInterface pAddress ;
// Constructor that handles just the name and the address
Person(String firstName,
String lastName,
int streetNumber,
String streetName,
String country,
AddressInterface pAddress){
this.firstName = firstName;
this.lastName = lastName;
this.streetNumber = streetNumber;
this.streetName = streetName;
this.country = country;
AddressInterface personAddress = new AddressImpl(this.streetNumber
,
this.streetName, this.country);
pAddress = personAddress;
}
// Get person's name
public String getName(){
return firstName + " " + lastName;
}
//
// Implement methods in MyOwnInterface
//
public AddressInterface getAddress() {
return personAddress;
}
}
Should the Person class include a variable of type AddressInterface ?
How should I address this in the Main class to use MyOwnInterface to access
the Person data ?
Thank You and Regards,
Jeff
[email protected]
--
You received this message because you are subscribed to the Google Groups
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.