//File : CH15pc8.h //Author : Andre Long //Due : November 10, 2004 @ 24:00 //Description: Midterm 2 #include using namespace std; class PersonData { protected: string lastName; string firstName; string address; string city; string state; string zip; string phone; public: void setLastName(string ln) { lastName=ln; } void setFirstName(string fn) { firstName=fn; } void setAddress(string add) { address=add; } void setCity(string cit) { city=cit; } void setState(string st) { state=st; } void setZip(string zp) { zip=zp; } void setPhone(string ph) { phone=ph; } string getLastName() { return lastName; } string getFirstName() { return firstName; } string getAddress() { return address; } string getCity() { return city; } string getState() { return state; } string getZip() { return zip; } string getPhone() { return phone; } PersonData() { lastName="Bush"; firstName="George"; address="1600 Pennsylviania Ave."; city="Washington"; state="DC"; zip="20019"; phone="202-589-1846"; } }; //specification for CustomerData class CustomerData : public PersonData { protected: int customerNumber; bool mailingList; char Ans; char y; char Y; public: void setCustomerNumber(int cn) { customerNumber=cn; } void setMailingList(char responce) { Ans=responce; if(Ans==y || Ans==Y) mailingList=true; else mailingList=false; } int getCustomerNumber() { return customerNumber; } bool getMailingList() { return mailingList; } CustomerData() { customerNumber=1; mailingList=false; } }; //specification for PreferredCustomer class PreferredCustomer : public CustomerData { protected: float purchaseAmount; float discountLevel; public: void setPurchaseAmount(float in) { purchaseAmount=in; } void setDiscountLevel(float inn) { discountLevel=inn; } float getPurchaseAmount() { return purchaseAmount; } float getDiscountLevel() { return discountLevel; } PreferredCustomer() { purchaseAmount=0; discountLevel=0; } float accumulatedSales(float x) { (*this).purchaseAmount = (*this).purchaseAmount + x; return (*this).purchaseAmount; } float typeCustomersavings() { if(purchaseAmount<500) { return discountLevel=0; } else if(purchaseAmount>=500) { return discountLevel=.05; } else if(purchaseAmount>=1000) { return discountLevel=.06; } else if(purchaseAmount>=1500) { return discountLevel=.07; } else if(purchaseAmount>=2000) { return discountLevel=.1; } } };