Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Instead of maxing out at 500, use linked lists to modify the c++ program to handle as many entries as required. (b) Add or

(a) Instead of maxing out at 500, use linked lists to modify the c++ program to handle as many entries as required.

(b) Add or delete a new entry to the address book.

(c) Allow the user to save the data in the address book.

Below are the included classes

image text in transcribed

// date.h

#pragma once

#ifndef DATE_TYPE

#define DATE_TYPE

#include

#include

#include

#include

using namespace std;

class dateType

{

public:

void setDate(int month, int day, int year);

void getDate(int& month, int& day, int& year);

int getDay() const;

int getMonth() const;

int getYear() const;

void isLeapYear();

void printDate()const;

dateType(int month = 1, int day = 1, int year = 1900);

private:

int dMonth;

int dDay;

int dYear;

};

#endif

// date.cpp

#include "date.h"

#include

#include

#include

#include

#include

using namespace std;

void dateType::setDate(int month, int day, int year)

{

char dateStr[9];

_strdate_s(dateStr);

int thisYear = 2000 + (dateStr[6] - 48) * 10 + dateStr[7] - 48;

if ((year >= 1900) && (year

dYear = year;

else

dYear = 1900;

if (month >= 1 && month

dMonth = month;

else

dMonth = 1;

int days[12] = { 31,28,31,30,31,30,31,31,30,31,31,31 };

if ((dYear % 400 == 0) || (dYear % 100 != 0 && dYear % 4 == 0))

days[1]++;

if (day >= 1 && day

dDay = day;

else

dDay = 1;

}

void dateType::getDate(int& month, int& day, int& year)

{

month = dMonth;

day = dDay;

year = dYear;

}

int dateType::getDay() const

{

return dDay;

}

int dateType::getMonth() const

{

return dMonth;

}

int dateType::getYear() const

{

return dYear;

}

void dateType::printDate() const

{

cout

}

dateType::dateType(int month, int day, int year)

{

setDate(month, day, year);

}

void dateType::isLeapYear()

{

if (dYear % 400 == 0 || (dYear % 100 != 0 && dYear % 4 == 0))

cout

else

cout

}

// address.h

#pragma once

#ifndef ADDRESS_TYPE

#define ADDRESS_TYPE

#include

#include

#include

#include

using namespace std;

class addressType

{

public:

void setStreet(string myStreet);

void setCity(string myCity);

void setState(string myState);

void setZIP(int myZIP);

string getStreet() const;

string getCity() const;

string getState() const;

int getZIP() const;

void printAddress() const;

addressType(string = "", string = "", string = "", int = 0);

private:

string street;

string city;

string state;

int ZIP;

};

#endif

// address.cpp

#include "address.h"

#include

#include

#include

#include

using namespace std;

void addressType::setStreet(string myStreet)

{

street = myStreet;

}

void addressType::setCity(string myCity)

{

city = myCity;

}

void addressType::setState(string myState)

{

state = myState;

}

void addressType::setZIP(int myZIP)

{

ZIP = myZIP;

}

string addressType::getStreet() const

{

return street;

}

string addressType::getCity() const

{

return city;

}

string addressType::getState() const

{

return state;

}

int addressType::getZIP() const

{

return ZIP;

}

void addressType::printAddress() const

{

cout

}

addressType::addressType(string myStreet, string myCity, string myState, int myZIP)

{

setStreet(myStreet);

setCity(myCity);

setState(myState);

setZIP(myZIP);

}

// person.h

#pragma once

#ifndef PERSON_TYPE

#define PERSON_TYPE

#include

#include

#include

#include

#include

using namespace std;

class personType

{

public:

void setFirstName(string myFirstName);

void setLastName(string myLastName);

string getFirstName() const;

string getLastName() const;

void print() const;

personType(string = "", string = "");

private:

string firstName;

string lastName;

};

#endif

// person.cpp

#include "person.h"

#include

#include

#include

#include

#include

using namespace std;

void personType::setFirstName(string myFirstName)

{

firstName = myFirstName;

}

void personType::setLastName(string myLastName)

{

lastName = myLastName;

}

string personType::getFirstName() const

{

return firstName;

}

string personType::getLastName() const

{

return lastName;

}

void personType::print() const

{

cout

}

personType::personType(string myFirstName, string myLastName)

{

setFirstName(myFirstName);

setLastName(myLastName);

}

5. 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 a. 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 b. member variables. c. 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 i. Load the data into the address book from a disk i. Sort the address book by last name. ii. Search for a person by last name. v. Print the address, phone number, and date of birth (if it exists) of a given person . Print the names of the people whose birthdays are in a given month vi. Print the names of all the people between two last names vi. Depending on the user's request, print the names of a family members, friends, or business associates 5. 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 a. 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 b. member variables. c. 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 i. Load the data into the address book from a disk i. Sort the address book by last name. ii. Search for a person by last name. v. Print the address, phone number, and date of birth (if it exists) of a given person . Print the names of the people whose birthdays are in a given month vi. Print the names of all the people between two last names vi. Depending on the user's request, print the names of a family members, friends, or business associates

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

Students also viewed these Databases questions