title: Create and use composition class in Java to create and store objects using user-inputs
body: <p>I am trying to build an application that displays property listings, and allows the user to add a property, delete a property, or update one.
  <br><br>
  The <strong>bolded</strong> words are things I think should be Classes.</p>
  
  <p>A <strong>Property</strong> has an <strong>Address</strong> and a <strong>ViewingArrangement</strong>.<Br>
  An <strong>Address</strong> has a streetNumber, streetName, suburb and postalCode.<br>
  A <strong>ViewingArrangement</strong> has a <strong>ContactPerson</strong> and an openTime.<br>
  A <strong>ContactPerson</strong> has a name, officeLocation and phoneNumber.<br>
  <br>
  My issue here is that, I don't know EXACTLY how to create a class that consists of an object of another class.<br>
  Eg. <strong>ViewingArrangement</strong> has an openTime, and <strong>ContactPerson</strong>, which is a class. <Br>
  <br>
  How do I create <strong>ViewingArrangement</strong> class? How do I do the getter-setters, constructors etc? I've been trying and changing my program the entire day, I still can't quite get it right. I'm new, please help!
  <br></p>
  
  <pre><code>package PropertyListing.data;
  
  public class ContactPerson {
  String cpName;
  String office;
  String pNo;
  
  public ContactPerson(String name, String off, String pno)
  {
      String cpName = name;
      String office = off;
      String pNo = pno;
  }
  
  public void setCpName(String cpName) 
  {
      this.cpName = cpName;
  }
  
  public String getCpName() 
  {
      return cpName;
  }
  
  public String getOffice() 
  {
      return office;
  }
  
  public void setOffice(String office) 
  {
      this.office = office;
  }
  
  public String getPno() 
  {
      return pNo;
  }
  
  public void setPno(String pno) 
  {
      this.pNo = pno;
  }
  }
  </code></pre>
  
  <p>As follows is my ViewingArrangement class.. Please help :(
  <br></p>
  
  <pre><code>package PropertyListing.data;
  
  public class ViewingArrangement {
  String availTime;
  private ContactPerson cp;
  
  public ViewingArrangement (String availT, ContactPerson p)
  {
    this.availTime = availT;
  }
  
  public String getVAtime ()
  {
      return availTime;
  }
  
  public void setVAtime(String availTime)
  {
      this.availTime = availTime;
  }
  
  public ContactPerson getCP()
  {
      return cp;
  }
  
  public void setCP(ContactPerson cp)
  {
      this.cp = cp;
  }
  </code></pre>
  
  <p><br>
  The above are what I ended up after an entire day of messing around, googling and changing here and there, please go easy on me.<br>
  <br>
  I hope that once I solve this issue, I can store my Property properly and my JList(I did setModel to DefaultListModel) would display the Property out nicely instead of displaying things like "PropertyListing.data.Property@55f716" etc. <br>
  <br>
  I really hope it is the aforementioned problem that I have that is causing this bad storing/displaying..</p>