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

Client Class - Class Composition (Aggregation) Create the new project Assign05-C

ID: 3734264 • Letter: C

Question

Client Class - Class Composition (Aggregation) Create the new project Assign05-ClientComposition. Click the Project tab and select Add Class... Click C++ Class and then the Add button to add class files to the project. Create simple classes Name and Addr. Code the.h header files and.cpp implementation modules for these two classes: Use this class description (public function prototypes and private functions and data members) for Name.h: #pragma once Name.h class header #include using namespace std; class Name public: Name(0); Name(string 1, string f, string m); void setName(string lName, string FName, string mid); void displayName() const; / display first middle last name string to cout private: string last; string first; string middle; Code the Addr class using this Addr. specification: Addr.h class header #pragma Price #include using namespace std; class Addr public: Addr(); // default constructor Adde/string strAddr, string city, string state, string Zip) Construel 4-part address information void setAddr(string a, string C, string S, String 2); // set streetAddr, city, state.zip displayAddr() void // display address info on two lines const; private: string string streetAddr; // streetAddr - number and street (plus direction and qualitiers - like Ave. Rd, Blvd. streetAddr; string city: CO CAVCProjects00PClientCompositionDebugClientcompositionere string state; // 5-digit zip code string zip; Martha L. Bart. 45210k Kansas City, MO 64118 LAIo l Engle Kansas City, MO 64129 output of .displayClient() ClientComposition.cpp Buat Hay Worthington 295 Hellefontaine t no altro Add Client class.h and.cpp files to the project. The Client class is comprised of a numeric identifier, plus the aggregated contents of an instance of the Name and Addr classes. PASSO AI uy to continue.

Explanation / Answer

//ClientComposition.cpp
#include <iostream>
#include "Client.h"

using namespace std;


int main()
{
   Client client01("Barton", "Martha", "L", "4521 Oak", "Kansas City", "MO", "64110");
   Client client02("Engle", "Harold", "", "1711 E. 68th St", "Kansas City", "MO", "64129");
   Client client03("Worthington", "Burton", "Ray", "2735 Bellefontaine", "Kansas City", "MO", "64109");
   Client client04;

   client01.displayClient();
   client02.displayClient();
   client03.displayClient();
   client04.displayClient();
  
   cout << endl;
   system("pause");
   return 0;
}
-------------------------------------------
//Addr.cpp
#include "Addr.h"
#include <iostream>

using namespace std;

Addr::Addr()
{
   streetAddr = "no address";
   city = "no city";
   state = "no state";

}


Addr::Addr(string strAddr, string aCity, string aState, string aZip)
{
   streetAddr = strAddr;
   city = aCity;
   state = aState;
   zip = aZip;
}


void Addr::setAddress(string a, string c, string s, string z)
{
   streetAddr = a;
   city = c;
   state = s;
   zip = z;
}

void Addr::displayAddr()   const
{
   cout << streetAddr << endl;
   cout << city << ", " << state << " " << zip << endl;
}
---------------------------------------------------------------------
//Addr.h
#pragma once
#include <string>

using namespace std;

class Addr
{
public:
   Addr();
   Addr(string strAddr, string city, string state, string zip);

   void setAddress(string a, string c, string s, string z);
   void displayAddr()   const;

private:
   string streetAddr;
   string city;
   string state;
   string zip;
};
---------------------------------------------
//Client.cpp
#include "Client.h"
#include <iostream>

using namespace std;


Client::Client()
{
   clientID = ++clientNumber;
}


Client::Client(string lName, string fName, string mid, string strAddr, string c, string s, string z)
   :clientName(lName, fName, mid),
   clientAddr(strAddr, c, s, z)
{
   clientID = ++clientNumber;
}

void Client::displayClient()   const
{
   cout << endl << clientID << endl;
   clientName.displayName();
   clientAddr.displayAddr();
}
---------------------------------------------------
//Client.h
#pragma once
#include "Name.h"
#include "Addr.h"
#include <string>

using namespace std;

static int clientNumber = 1000;

class Client
{
public:
   Client();
   Client(string l, string f, string m, string a, string c, string s, string z);

   void displayClient()   const;

private:
   int clientID;
   Name clientName;
   Addr clientAddr;
};
------------------------------------------------------
//Name.cpp
#include "Name.h"
#include <iostream>

using namespace std;


Name::Name()
{
   first = "no name";
}


Name::Name(string l, string f, string m)
{
   last = l;
   first = f;
   middle = m;
}

void Name::setName(string lName, string fName, string mid)
{
   last = lName;
   first = fName;
   middle = mid;


}

void Name::displayName()   const
{
   cout << first << ' ' << middle << ' ' << last << endl;
}
----------------------------------------------------------------
//Name.h
#pragma once
#include <string>


using namespace std;

class Name
{
public:
   Name();
   Name(string l, string f, string m);

   void setName(string lName, string fName, string mid);
   void displayName()   const;

private:
   string last;
   string first;
   string middle;
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote