Using classes, design an online address book to keep track of the names, addresses, phone numbers, and dates of birth of family members, close friends, and certain business associates. Your program should be able to handle a maximum of 500 entries. Define a class addressType that can store a street address, city, state, and ZIP code. Use the appropriate functions to print and store the address. Also, use constructors to automatically initialize the member variables. Define a class extPersonType using the class personType (as defined in Example 10-10, Chapter 10), the class dateType(as designed in this chapter’s Programming Exercise 2), and the class addressType. Add a member variable to this class to classify the person as a family member, friend, or business associate. Also, add a member variable to store the phone number. Add (or override) the functions to print and store the appropriate information. Use constructors to automatically initialize the member variables. Define the class addressBookType using the previously defined classes. An object of the type addressBookType should be able to process a maximum of 500 entries.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Using classes, design an online address book to keep track of the names, addresses, phone numbers, and dates of birth of family members, close friends, and certain business associates. Your program should be able to handle a maximum of 500 entries.
-
Define a class addressType that can store a street address, city, state, and ZIP code. Use the appropriate functions to print and store the address. Also, use constructors to automatically initialize the member variables.
-
Define a class extPersonType using the class personType (as defined in Example 10-10, Chapter 10), the class dateType(as designed in this chapter’s
Programming Exercise 2), and the class addressType. Add a member variable to this class to classify the person as a family member, friend, or business associate. Also, add a member variable to store the phone number. Add (or override) the functions to print and store the appropriate information. Use constructors to automatically initialize the member variables. -
Define the class addressBookType using the previously defined classes. An object of the type addressBookType should be able to process a maximum of 500 entries.
The program should perform the following operations:
- Load the data into the address book from a disk (Ch11_Ex5Data.txt).
- Sort the address book by last name.
- Search for a person by last name (option 1).
- Print the address, phone number, and date of birth (if it exists) of a given person (option 2).
- Print the names of the people whose birthdays are in a given month (option 3).
- Print the names of all the people between two last names (option 4).
- Depending on the user’s request, print the names of all family members, friends, or business associates (option 5).
- Print the entire address book (option 6).
- Save the sorted address book to a file (option 7).
- Terminate the program (option 9).
An example of the program is shown below:
Enter file name: Ch11_Ex5Data.txt Welcome to the address book program. Choose among the following options:
1: To see if a person is in the address book
2: Print the information of a person
3: Print the names of person having birthday in a particular month
4: Print the names of persons between two last names
5: Print the names of persons having a particular status
6: Print the address book
7: Save data
9: Terminate the program
2
Enter the last name of the person: Balto
Brave Balto
Date of Birth: 2-6-1975
Phone Number: 415-782-5555
Person Type: Business
Disney Road Orlando, Florida - 35672
Trending now
This is a popular solution!
Step by step
Solved in 2 steps