reset password
Author Message
304374842
Posts: 56
Posted 20:17 Oct 03, 2016 |

I am totally lost on making the Address class work with the overall package.  I understand that Person is the super-class and Student and Faculty are sub-classes.  My big problem is getting the Address object to work with those classes.  Any advice or pointers would be really really helpful!

 

rcamach7
Posts: 31
Posted 20:41 Oct 03, 2016 |

Create a separate class for Address and create an instance of it on the Person class. Basically, each person has an instance of an Address (only one, so not an array list) and the Person class should take in fields in to instantiate/fill in an address. (At least that's the way I did it)

304374842
Posts: 56
Posted 21:12 Oct 03, 2016 |

Thank you so much. 

epascua
Posts: 47
Posted 18:06 Oct 04, 2016 |
rcamach7 wrote:

Create a separate class for Address and create an instance of it on the Person class. Basically, each person has an instance of an Address (only one, so not an array list) and the Person class should take in fields in to instantiate/fill in an address. (At least that's the way I did it)

Hey! I've did something really similar actually, just to double check though, when you create the instance of the address in the person class, do you put the "" (for strings) and 0 (for int) for the parameters (so that it doesn't take in a null)? 

 

rcamach7
Posts: 31
Posted 23:39 Oct 04, 2016 |

Hey, I initially ran into the same problem. After looking over the slides I realized you could modify the Address class instead of sending blank/temp values. 

The way I did it was by adding public class Address()[]; followed by the original one that would actually take parameters. That way in your Person class you can instantiate an Address without sending it any values. Hope that helps.