Design a class named PersonData with the following member variables: ? lastName
ID: 3547517 • Letter: D
Question
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.
Next, design a class named CustomerData, which is derived from the PersonData class. The
CustomerData class 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.
A retail store has a preferred customer plan where customers may earn discounts on all their
purchases. The amount of a customer
Explanation / Answer
280
double PreferredCustomer::setdiscountLevel(double d) // should the first double be a void?
281
{
282
if(total >= 500)
283
{
284
cout << "You get a 5% discount." << endl;
285
}
286
287
if(total >= 1000)
288
{
289
cout << "You get a 6% discount." << endl;
290
}
291
292
if(total >= 1500)
293
{
294
cout << "You get a 7% discount." << endl;
295
}
296
297
if(total >= 2000)
298
{
299
cout << "You get a 10% discount." << endl;
300
}
301
302
if(total >= 0)
303
{
304
cout << "Invalid amount!" << endl;
305
}
306
307
else
308
cout << "You do not get a discount. << endl;
309
310
// should I have these if statements here or should they go in main?
311
312
// This was added to the end of customerDataMain.cpp
313
314
#include "preferredCustomer.h"
315
double t;
316
double d;
317
318
cout << "What is the total amount of all of your purchases? ";
319
cin >> t;
320
321
cout << PreferredCustomer.setdiscountLevel << endl;
322
323
// I'm not really sure how to finish main since I'm not sure the other code in the PreferredCustomer class is correct.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.