1 / 15

Example Project

Example Project. Previously. GUI Example Switch. Overview. Study a problem and discompose it. Overview. Write a simple Address Book Application Each entry should be able to store the following information about an address: Street name Number City Postcode Country

shiro
Download Presentation

Example Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Example Project

  2. Previously • GUI Example • Switch

  3. Overview Study a problem and discompose it

  4. Overview • Write a simple Address Book Application • Each entry should be able to store the following information about an address: • Street name • Number • City • Postcode • Country • Occupants - each occupant should have a first name, last name, date of birth and title (Mr, Ms, Miss, Mrs)

  5. Overview • The application should be able to perform at least the following functions: • Add a new address • Delete an existing address • Display an address • Add a new occupier record • Delete an existing occupier record • Display any addresses on a given city • Display any addresses on a given postcode • Display addresses for a particular occupier

  6. Data Address Book • Write a simple Address Book Application • Each entry should be able to store the following information about an address: • Street name • Number • City • Postcode • Country • Occupants - each occupant should have a first name, last name, date of birth and title (Mr, Ms, Miss, Mrs) address occupant

  7. Data • Address • Street name • Is the address a street name? • Has the address a street name? • Number • Is the address a number? • Has the address a number? • City • Is the address a city? • Has the address a city? No member variable Yes No member variable Yes No member variable Yes

  8. Data • Address • Postcode • Is the address a postcode? • Has the address a postcode? • Country • Is the address a country? • Has the address a country? • Occupants • Is the address the occupants? • Has the address the occupants? No member variable Yes No member variable Yes s No member variable Yes

  9. Data • Address public class Address { private String mstrStreetName; privateintmiNumber; private String mstrCity; private String mstrPostcode; private String mstrCountry; private Vector<Occupant> mOccupants; public Address(String strStreetName, intiNumber, String strCity, String strPostcode, String strCountry) { mOccupants = new Vector<Occupant>(); } // Constructor () ... } // end class Address

  10. Occupant • Occupant • First name • Is the address a first name? • Has the address a first name? • Last name • Is the address a last name? • Has the address a last name? • Date of birth • Is the address a date of birth? • Has the address a date of birth? No member variable Yes No member variable Yes No member variable Yes

  11. Occupant • Occupant • Title (Mr, Ms, Miss, Mrs) • Is the address a title? • Has the address a title? • Addresses • Is the address a last name? • Has the address a last name? No member variable Yes s No member variable Yes

  12. Data ? • Occupier public class Occupier { private String mstrFirstName; private String mstrLastName; private Date mBirthDate; private Vector<Address> mAddresses; public Address(String strStreetName, intiNumber, String strCity, String strPostcode) { mAddresses = new Vector<Address>(); } // Constructor () ... } // end class Address Occupier(String strFirstName, String mstrLastName, Date birthDate) {

  13. Data • Occupier public class Occupier { private String mstrFirstName; private String mstrLastName; private Date mBirthDate; private Vector<Address> mAddresses; public Occupier(String strFirstName, String mstrLastName, Date birthDate) { mAddresses = new Vector<Address>(); } // Constructor () ... } // end class Address Occupier(String strFirstName, String mstrLastName, Date birthDate) {

  14. Data • Address Book  is a class AddressBook • Data • Contains Addresses  Vector of Addresses • Need functionality; methods • Add new addresses • Remove existing address • Load from file • Save to file Add Remove Load Save

  15. Data • Occupier Book  is a class ListOccupiers • Data • Contains Occupiers  Vector of Occupiers • Need functionality; methods • Add new occupier • Remove existing occupier • Load occupiers from file • Save occupiers in to file Add Remove Load Save

More Related