// PROG1709.CPP
// This program uses one record, implemented with struct,
// used by another data structure, implemented with class.
                                                      


 /* APCS Examination Alert
The APCS Committee advises students to use class for all situations where the
intention is to create a new class.The APCS Committee recommends that struct
is used for record data structures that do not contain functions and will
 not be used as objects.Technically, a data structure created with struct
  is a CLASS.However, if the data is not protected with private and the data
   is accessed directly then the data type will be usedand treated like a
   NON-OOP record data structure,and not a CLASS.   */


#include <iostream.h>
#include <conio.h>
#include "APSTRING.H"


struct Location
{
   apstring Street;
   apstring CityStateZip;
};

class Worker
{
   private:
      apstring FirstName;
      apstring LastName;
      Location Address;
      apstring Phone;
   public:
      void EnterData();
      void MailAddress();
      void PhoneListing();
};


void main()
{
   clrscr();
   Worker Employee;
   Employee.EnterData();
   Employee.MailAddress();
   Employee.PhoneListing();
   getch();
}


void Worker::EnterData()
{
   cout << "Enter First Name     ===>>  ";
   getline(cin,FirstName);
   cout << "Enter Last Name      ===>>  ";
   getline(cin,LastName);
   cout << "Enter Street         ===>>  ";
   getline(cin,Address.Street);
   cout << "Enter City State Zip ===>>  ";
   getline(cin,Address.CityStateZip);
   cout << "Enter Phone Number   ===>>  ";
   getline(cin,Phone);
}

void Worker::MailAddress()
{
   cout << endl << endl;
   cout << FirstName << " " << LastName << endl;
   cout << Address.Street << endl;
   cout << Address.CityStateZip << endl;
}

void Worker::PhoneListing()
{
   cout << endl << endl;
   cout << LastName << " " << FirstName << "  "
	<< Address.Street << " ......." << Phone << endl;
}


