Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please program in C++. ONLY NEED TO DO PART 2. Only need to refer to part 1 for

ID: 3888334 • Letter: P

Question

Please program in C++. ONLY NEED TO DO PART 2. Only need to refer to part 1 for the necessary member variables and classes.

Part 1

Part2:

Design a class named PersonData with the following member variable:s . lastName . firstName . address city state 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 Create a program that does the following Create a function enterNCustomers (int n) that asks to enter n number customers. All the customer fields must be filled in, and the result of the function is a vector containing n customer objects. Note that you may read customer info in from a text file it's up to you. User input or input from a file Create another function that displays all the customer information to the console

Explanation / Answer

PrefferedCustomer.h

====


#ifndef __PREF_CUST__
#define __PREF_CUST__


#include "CustomerData.h"
#include <cassert>

class PrefferedCustomer :
   public CustomerData
{
private:
   double purchasesAmount;
   double discountLevel;

public:
   PrefferedCustomer();
   ~PrefferedCustomer();

   void setPurchasesAmount(double a);
};

#endif

PrefferedCustomer.cpp

====

#include "PrefferedCustomer.h"


PrefferedCustomer::PrefferedCustomer()
{
}


PrefferedCustomer::~PrefferedCustomer()
{
}

void PrefferedCustomer::setPurchasesAmount(double a)
{
   // check if user has made a purchase, also prevents negative
   // data entrance.
   assert(a > 0);

   this->purchasesAmount = a;

   if (purchasesAmount <= 500) {
       this->discountLevel = 5;
   } else if (purchasesAmount <= 1000) {
       this->discountLevel = 6;
   } else if (purchasesAmount <= 1500) {
       this->discountLevel = 7;
   } else if (purchasesAmount <= 2000) {
       this->discountLevel = 10;
   } else {
       // can't get customer a discount more than 10%.
   }

}


Notes:

I could not create function enterNCustomers() because I don't have your previous code. Main logic is to manipulate discount as purchasedAmount is added or manipulated.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote