0% found this document useful (0 votes)
42 views2 pages

Assignment 2: 1. Persondata Class

The document describes an assignment to create classes to model customer data for a retail store. It involves: 1. A PersonData class with name, address and phone number attributes. 2. A CustomerData class derived from PersonData with a customer ID number and mailing list preference. 3. A PreferredCustomer class derived from CustomerData to track purchase amounts and discount levels, which are tied to spending tiers for preferred customers. 4. A driver program is to demonstrate the PreferredCustomer class.

Uploaded by

sheraz mehmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Assignment 2: 1. Persondata Class

The document describes an assignment to create classes to model customer data for a retail store. It involves: 1. A PersonData class with name, address and phone number attributes. 2. A CustomerData class derived from PersonData with a customer ID number and mailing list preference. 3. A PreferredCustomer class derived from CustomerData to track purchase amounts and discount levels, which are tied to spending tiers for preferred customers. 4. A driver program is to demonstrate the PreferredCustomer class.

Uploaded by

sheraz mehmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 2 Due Date: 31/05/2018

1. PersonData class
Design a class named PersonData with the following member variables:
 lastName
 firstName
 address
 city
 state
 zip
 phone
Write the appropriate accessor and mutator functions for these member variables.

2. CustomerData class
The class is derived from the PersonData and should have the following member variables:
 customerNumber
 mailingList

The customerNumber variable will be used to hold a unique integer for each customer. The
mailingList variable should be a bool. It will be set to true if the customer wishes to be on a
mailing list, or false if the customer does not wish to be on a mailing list. Write appropriate
accessor and mutator functions for these member variables.

3. PreferredCustomer class
A retail store has a preferred customer plan where customers may earn discounts on all their
purchases. The amount of a customer’s discount is determined by the amount of the customer’s
cumulative purchases in the store.
 When a preferred customer spends Rs. 500, he or she gets a 5% discount on all future
purchases.
 When a preferred customer spends Rs. 1,000, he or she gets a 6% discount on all future
purchases.
 When a preferred customer spends Rs. 1,500, he or she gets a 7% discount on all future
purchases.
 When a preferred customer spends Rs. 2,000 or more, he or she gets a 10% discount on
all future purchases.

Design a class named PreferredCustomer, which is derived from the CustomerData class. The
PreferredCustomer class should have the following member variables:
 purchasesAmount (a double)
 discountLevel (a double)

The purchasesAmount variable holds the total of a customer’s purchases to date. The
discountLevel variable should be set to the correct discount percentage, according to the store’s
preferred customer plan. Write appropriate member functions for this class.
Input Validation: Do not accept negative values for any sales figures.

4. A Driver Program
Write a simple program that demonstrates the working of PreferredCustomer class.

You might also like