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

** PLEASE READ THE SPECIAL REQUIREMENT FULLY BEFORE POSTING... THANKS! Create a

ID: 3670233 • Letter: #

Question

** PLEASE READ THE SPECIAL REQUIREMENT FULLY BEFORE POSTING... THANKS!

Create a C++ class called Employee which will implement the Employee constructor. Remember that once the Name of the Employee is entered and the Address of the Employee is entered, once you add an SSN you are ready to create an employee.

I need help adding the bolded portion below to my current files. I have created all necessary files and it compiles and runs without errors. I don't need help with anything else other than how to add the bolded portion below to my files so that it prints the e1 Employee under the given name. Thank you!

Employee (Employee.cpp) class will have:

In the void main() function you would declare:

a Name n;

an Address A;

and an Employee e;

and print e using the printEmployee().

Also you need to declare:

A Name n1: George Victor Meghabghab

an Address a1: your own address

string ssn1: 987-65-4321

An employee e1 which has a name n1, and address A1, and ssn1.

Print e1 using printEmployee().

Here are my files,

Address.h

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

#ifndef ADDRESS_H
#define ADDRESS_H

class Address

{

private:
   string Street;
   string City;
   string State;
   string Zip;

public:
   Address() // default constructor
   {
       Street = "99999 Sunset Boulevard";
       City = "Beverly Hills";
       State = "CA";
       Zip = "99999";
   }

   Address(string St, string Ct, string st, string zip)
   {
       Street = St;
       City = Ct;
       State = st;
       Zip = zip;
   }

   ~Address(){ ; } // destructor
   string getCity() // returns City
   {
       return City;
   }
   string getState() // returns State
   {
       return State;
   }
   string getStreet() // returns Street
   {
       return Street;
   }
   string getZip() // returns Zip
   {
       return Zip;
   }
   void prtAddress() // Displays Address
   {
       cout << Street << ", " << City << ", " << State << ", " << Zip << endl;
   }
};
#endif

___________________________________________________________________

Employee.h

#include <iostream>
#include <iomanip>
#include <string>
#include "Address.h"
#include "Name.h"

using namespace std;

#ifndef EMPLOYEE_H
#define EMPLOYEE_H

class Employee
{
private:
   Address FullAddress;
   Name FullName;
   string SSN; // string variable for Social Security Number
public:
   Employee() // default constructor
   {
       Name FullName("John", "H.", "Doe");
       Address FullAddress("99999 Sunset Boulevard", "Beverly Hills", "CA", "99999");
       SSN = "999-99-9999";
   }
   Employee(string &ssn, Name &nm, Address &ad)
   {
       SSN = ssn;
       FullName = nm;
       FullAddress = ad;
   }
   ~Employee(){ ; } // destructor
   Name getName() // returns full name
   {
       return FullName;
   }
   Address getAddress() // returns full address
   {
       return FullAddress;
   }
   string getSSN() // returns SSN
   {
       return SSN;
   }
   void prtEmployee() // Displays name, address, and SSN for the employee
   {
       FullName.prtName();
       FullAddress.prtAddress();
       cout << SSN << endl;
   }
};
#endif

_______________________________________________

Name.h

#include<iostream>
#include<iomanip>
#include<string>

using namespace std;

#ifndef NAME_H
#define NAME_H

class Name
  
{
  
private:
  
       string First;
  
       string Middle;
  
       string Last;
  
public:
  
       Name() // Default constructor
      
   {
      
           First = "John";
      
           Middle = "H.";
      
           Last = "Doe";
      
   }
  
       Name(string Fi, string Mi, string La)
      
   {
      
           First = Fi;
      
           Middle = Mi;
      
           Last = La;
      
   }
  
       ~Name(){ ; }
  
       string getFirst() // returns First name
      
   {
      
           return First;
      
   }
  
       string getMiddle() // return Middle name
      
   {
      
           return Middle;
      
   }
  
       string getLast() // returns Last name
      
   {
      
           return Last;
      
   }
  
       void prtName() // Displays full name
      
   {
      
           cout << First << " " << Middle << " " << Last << endl;
  
   }

};
#endif

_________________________________________________________

Employee.cpp

#include<iostream>
#include<iomanip>
#include<string>
#include "Name.h"
#include "Address.h"
#include "Employee.h"

using namespace std;

void main()
{
   Name n;
   Address A;
   Employee e;


   cout << "Name: " << endl;
   n.prtName(); // Displays name from class Name
   cout << "Address: " << endl;
   A.prtAddress(); // Displays address from class Address
   cout << "Employee: " << endl;
   e.prtEmployee(); // Displays name, address, and SSN from class Employee

   cin.get();

}

Explanation / Answer

Employee.cpp

#include <iostream>
#include <string>
#include "Address.h"
#include "Name.h"
#include "Employee.h"

using namespace std;

int main()
{
   //Declare objects without arguments
   Name n;
   Address A;
   Employee e;
  
   //Print values for default constructor
   e.printEmployee();
  
   //Declare objects with specified arguments
   Name n1("George", "Victor", "Meghabghab");
   Address A1("140 E Glenwood Ave", "Knoxville", "TN", "37917");
   string ssn1("987-65-4321");
   Employee e1(n1, A1, ssn1);
  
   //Print values for employee constructed with arguments
   e1.printEmployee();
   return 0;
};

Name.h
//Include guard
#ifndef NAME_H_
#define NAME_H_
#include <iostream>
#include <string>

class Name
{

public:

   //Constructors
   /** Constructs an person's full name with given values.
       @param first The first name
       @param middle The middle name
       @param last The last name
   */
   Name(std::string first, std::string middle, std::string last) :
       first_name(first), middle_name(middle), last_name(last) {}

   /** Constructs a default name.
   */
   Name() : first_name("John"), middle_name("H."), last_name("Doe") {}

   //Destructor
   ~Name() { ; }

   //Accessor functions (getters)
   /** Gets the full name.
   */
   std::string getFirstLast() const
   {
       return first_name;
       return middle_name;
       return last_name;
   }

   // Other Functions
   /** Prints the full name to the console.
   */
   void printName()
   {
       std::cout << first_name << " " << middle_name << " " << last_name
           << std::endl;
   }

private:

   //Data fields
   std::string first_name;
   std::string middle_name;
   std::string last_name;

};

#endif

Employee.h

//Include guard
#ifndef EMPLOYEE_H_
#define EMPLOYEE_H_
#include <iostream>
#include <string>
#include "Name.h"
#include "Address.h"

class Employee
{

public:

   //Constructors
   /** Constructs an employee.
       @param na The employee's full name
       @param ad The employee's address
       @param ss The employee's SSN
   */
   Employee(Name na, Address ad, std::string ss) : n(na), A(ad), SSN(ss) {}
  
   /** Constructs a default employee.
   */
   Employee() : n("John", "H.", "Doe"), A("9999 Sunset Boulevard",
       "Beverly Hills", "CA", "99999"), SSN("999-99-9999") {}

   //Destructor
   ~Employee() { ; }

   //Accessor functions (getters)
   std::string getName() { return n.getFirstLast(); }

   std::string getAddress()
   {
       return A.getStreet();
       return A.getCity();
       return A.getState();
       return A.getZip();
   }

   std::string getSSN() { return SSN; }

   // Other Functions
   /** Prints all of the employee's information to the console.
   */
   void printEmployee()
   {
       std::cout << "Employee:" << std::endl;
       n.printName();
       A.printAddress();
       std::cout << SSN << std::endl;
   }

private:

   //Data fields
   Name n;
   Address A;
   std::string SSN;

};

#endif

Address.h
//Include guard
#ifndef ADDRESS_H_
#define ADDRESS_H_
#include <iostream>
#include <string>

class Address
{

public:

   //Constructors
   /** Constructs an address with given values.
       @param str The street number and street name
       @param cit The city name
       @param sta The state name
       @param zc The zip code
   */
   Address(std::string str, std::string cit, std::string sta, std::string zc) :
       Street(str), City(cit), State(sta), Zip(zc) {}

   /** Constructs a default address.
   */
   Address() : Street("9999 Sunset Boulevard"), City("Beverly Hills"),
       State("CA"), Zip("99999") {}

   //Destructor
   ~Address() { ; }

   //Accessor functions (getters)
   std::string getStreet() const { return Street; }
  
   std::string getCity() const { return City; }

   std::string getState() const { return State; }

   std::string getZip() const { return Zip; }

   // Other Functions
   /** Prints the full address to the console.
   */
   void printAddress()
   {
       std::cout << Street << " " << City << ", " << State
           << " " << Zip << std::endl;
   }

private:

   //Data fields
   std::string Street;
   std::string City;
   std::string State;
   std::string Zip;

};

#endif

output


Employee:                                                                                                                                                   
John H. Doe                                                                                                                                                 
9999 Sunset Boulevard Beverly Hills, CA 99999                                                                                                               
999-99-9999                                                                                                                                                 
Employee:                                                                                                                                                   
George Victor Meghabghab                                                                                                                                    
140 E Glenwood Ave Knoxville, TN 37917                                                                                                                      
987-65-4321