1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
|
#pragma once
#ifndef PersonData_H
#define PersonData_H
#include <string>
#include <iostream>
class PersonData
{
private:
std::string lastName;
std::string firstName;
std::string address;
std::string city;
std::string state;
std::string zipCode;
std::string phoneNum;
public:
PersonData();
~PersonData();
PersonData(std::string last, std::string first, std::string address, std::string city, std::string s, std::string zip, std::string phone);
//Accessors
void setlastName(std::string last);
void setfirstName(std::string first);
void setaddress(std::string add);
void setcity(std::string c);
void setstate(std::string s);
void setzipCode(std::string zip);
void setphoneNum(std::string phone);
//Mutators
std::string getlastName();
std::string getfirstName();
std::string getaddress();
std::string getcity();
std::string getstate();
std::string getzipCode();
std::string getphoneNum();
};
#endif // !PersonData_H;
#include "stdafx.h"
#include "PersonData.h"
PersonData::PersonData()
:lastName(""),firstName(""), address(""), state(""),city(""), zipCode(""), phoneNumber("")
{
}
PersonData::~PersonData()
{
}
PersonData::PersonData(std::string last, std::string first, std::string add, std::string c, std::string s, std::string zip, std::string phone)
:lastName(last), firstName(first), address(add), city( c), state( s), zipCode (zip), phoneNum( phone)
{
}
void PersonData::setlastName(std::string last)
{
lastName = last;
}
void PersonData::setfirstName(std::string first)
{
firstName = first;
}
void PersonData::setaddress(std::string add)
{
address = add;
}
void PersonData::setcity(std::string c)
{
city = c;
}
void PersonData::setstate(std::string s)
{
state = s;
}
void PersonData::setzipCode(std::string zip)
{
zipCode = zip;
}
void PersonData::setphoneNum(std::string phone)
{
phoneNum = phone;
}
std::string PersonData::getlastName()
{
return lastName;
}
std::string PersonData::getfirstName()
{
return firstName;
}
std::string PersonData::getaddress()
{
return address;
}
std::string PersonData::getcity()
{
return city;
}
std::string PersonData::getstate()
{
return state;
}
std::string PersonData::getzipCode()
{
return zipCode;
}
std::string PersonData::getphoneNum()
{
return phoneNum;
}
#pragma once
#ifndef CustomerData_H
#define CustomerData_H
#include "PersonData.h"
class CustomerData : public PersonData
{
private:
int customerNUM;
bool mailingList;
public:
CustomerData();
CustomerData(std::string last, std::string first, std::string add, std::string c, std::string s, std::string zip,std::string phone, int custNUM, bool mail);
//Accessors
void setcustomerNUM(int custNUM);
void setmailingList(bool mail);
//Mutators
int getcustomerNUM();
bool getmailingList();
};
#endif // !CustomerData_H;
#include "stdafx.h"
#include "CustomerData.h"
#include "PersonData.h"
CustomerData::CustomerData()
: personData() , customerNUM ( 0),mailingList( false)
{
}
CustomerData::CustomerData(std::string last, std::string first, std::string add, std::string c, std::string s, std::string zip,std::string phone, int custNUM, bool mail)
: personData(last,first,add,c,s,zip,phone), customerNUM(custNUM), mailingList(mail)
{
}
void CustomerData::setcustomerNUM(int custNUM)
{
customerNUM = custNUM;
}
void CustomerData::setmailingList(bool mail)
{
mailingList = mail;
}
int CustomerData::getcustomerNUM()
{
return customerNUM;
}
bool CustomerData::getmailingList()
{
return mailingList;
}
#include "stdafx.h"
#include "CustomerData.h"
void displayCUSTOMER(CustomerData C); //function used to display the customer information from an instance of CustomerData
int main()
{
CustomerData defaultCON; //object relates to the default constructor in CustomerData
defaultCon.setlastName("adria");
defaultCon.setfirstName("McRey");
defaultCon.setaddress("0874784784");
defaultCon.setcity("L.A");
defaultCon.setstate("California");
defaultCon.setzipCode("00000");
defaultCon.setphoneNum("1234567");
defaultCon.setcustomerNUM(5555);
defaultCon.setmailingList(true);
//object uses the second constructor in Customer Data to populate the information fields.
CustomerData info("Smith", "Joan", "123 Main Street", "Smithville", "NC", "99999", 12345, true);
std::cout << " Customer #1 \n";
std::cout << " ____________ \n";
displayCUSTOMER(defaultCON);
std::cout << " Customer #2 \n";
std::cout << " ____________ \n";
displayCUSTOMER (info);
return 0;
}
void displayCUSTOMER(CustomerData C)
{
std::cout << " Last Name: " << C.getlastName() << std::endl;
std:: cout << " First Name: " << C.getfirstName() << std::endl;
std::cout << " Address: " << C.getaddress() << std::endl;
std::cout << " State: " << C.getstate() << std::endl;
std::cout << " City: " << C.getcity() << std::endl;
std::cout << " Zip: " << C.getzipCode() << std::endl;
std::cout << " Customer Number: " << C.getcustomerNUM() << std::endl;
std::cout << " Mailing List? " << C.getmailingList() << std::endl;
}
|