Advertisement
silentkiler029

Question-06-a, b

Nov 2nd, 2021
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. // Question - 06
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. // ---( a )---
  6. class addressType {
  7. private:
  8.     string street;
  9.     string city;
  10.     string state;
  11.     int zip;
  12.  
  13. public:
  14.     addressType( string s, string c, string st, int z ) {
  15.         street = s;
  16.         city = c;
  17.         state = st;
  18.         zip = z;
  19.     }
  20.     string getStreet() {
  21.         return street;
  22.     }
  23.     string getCity() {
  24.         return city;
  25.     }
  26.     string getState() {
  27.         return state;
  28.     }
  29.     int getZIP() {
  30.         return zip;
  31.     }
  32.     void setStreet( string s ) {
  33.         street = s;
  34.     }
  35.     void setCity( string s ) {
  36.         city = s;
  37.     }
  38.     void setState( string s ) {
  39.         state = s;
  40.     }
  41.     void setZIP( int k ) {
  42.         zip = k;
  43.     }
  44.     void setAddress ( string s, string c, string st, int z ) {
  45.         street = s;
  46.         city = c;
  47.         state = st;
  48.         zip = z;
  49.     }
  50. }
  51.  
  52. // ---( b )---
  53. class extPersonType : public personType, public dateType, public addressType {
  54. private:
  55.     string classification;
  56.     string phoneNumber;
  57. public:
  58.     extPersonType( string s1, string s2, int d, int m, int y, string cl, string phn ) : personType( s1, s2 ) {
  59.         setDate( d, m, y );
  60.         classification = cl;
  61.         phoneNumber = phn;
  62.     }
  63.     void print() {
  64.         std::cout << getFirstName() << " " << getLastName() << "\n" << classification << " \n" << phoneNumber << " ";
  65.         std::cout << "\nDate Of Birth : " << getDay() << "-" << getMonth() << "-" << getYear() << "\n Address: ";
  66.         std::cout << getStreet() << ", " << getCity() << ", " << getState() << ", " << getZIP << endl;
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement