Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please implement the following problem in basic C++ code and include detailed co

ID: 3604559 • Letter: P

Question

Please implement the following problem in basic C++ code and include detailed comments so that I am able to understand the processes for the solution. Thanks in advance.

// personType.h

#include <string>

// personTypeImp.cpp

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 Derive a class extPersonType from the class personType. Add a member variable to this class to classify the person as a family member, friend, or business associate. (Hint: you can use an Integer data type to save this information. For example, 1 for family member, 2 for friend and 3 for business associate) In addition, add a member variable to store the address (using address Type object). Add proper statements on in the main function to test you code. Use constructors to automatically initialize the member variables. Sample Output: CAWINDOWSlsystem321cmd.exe John Denver is a business associate who 1ives at 42 W Warren Ave, Wayne, MI 48202 Press any key to continue .

Explanation / Answer

Here is the code for addressType.cpp:

#include <iostream>
using namespace std;
class addressType
{
    public:
        void printAddress() const;
        void setAddress(string strtAdd, string cty, string stt, string zip);
        addressType(string strtAdd = "", string cty = "", string stt = "", string zip = "");
    protected:
        string streetAddress;   //variable to store the street address.
        string city;           //variable to store the city.
        string state;           //variable to store the state.
        string zipCode;           //variable to store the zip code.
};
void addressType::printAddress() const
{
    cout << "Street: " << streetAddress << endl;
    cout << "City : " << city << endl;
    cout << "State : " << state << endl;
    cout << "Zip : " << zipCode << endl;
}
void addressType::setAddress(string strtAdd, string cty, string stt, string zip)
{
    streetAddress = strtAdd;
    city = cty;
    state = stt;
    zipCode = zip;
}
addressType::addressType(string strtAdd, string cty, string stt, string zip)
{
    streetAddress = strtAdd;
    city = cty;
    state = stt;
    zipCode = zip;
}

extPersonType.h:

#include <iostream>
#include "personType.cpp"
#include "dateType.cpp"
#include "addressType.cpp"
using namespace std;
class extPersonType : public personType, public dateType, public addressType
{
    public:
        void print() const;
        void setPersonName(string first, string last);
        enum Classification {Family, Friend, Business};
        extPersonType(string first, string last, Classification classify, addressType& address);
    private:
        personType name;
        //dateType dateOfBirth;
        string classification;
        addressType address;
        //string phoneNumber;
};

extPersonType.cpp:

#include <iostream>
#include "extPersonType.h"
using namespace std;
void extPersonType::print() const
{
    cout << "Name: ";
    personType::print();
   
    cout << "Date of Birth: ";
    dateType::printDate();
   
    cout << "Classification: " << classification << endl;
   
    cout << "Address: ";
    addressType::printAddress();
   
    //cout << "Phone Number: " << phoneNumber << endl;
}
void extPersonType::setPersonName(string first, string last)
{
    name.setName(first, last);
}  
extPersonType::extPersonType(string first, string last, Classification classify, addressType &address)
                   : personType(first, last)
{
    streetAddress = address;
    classification = classify;
}