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

A retail store has a preferred customer plan where customers can earn discounts

ID: 3779128 • Letter: A

Question

A retail store has a preferred customer plan where customers can 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 as follows:

When a preferred customer spends $500, he or she gets a 5 percent discount on all future purchases.

When a preferred customer spends $1000, he or she gets a 6 percent discount on all future purchases.

When a preferred customer spends $1500, he or she gets a 7 percent discount on all future purchases.

When a preferred customer spends $2000 or more, he or she gets a 10 percent discount on all future purchases.

Design a class named Person with properties for holding a person's name, address, and telephone number. Next, design a class named Customer, which is derived from the Person class. The Customer class should have a property for a customer number and a Boolean property indicating whether the customer wishes to be on a mailing list. Finally, design a class named PreferredCustomer, which is derived from the Customer class. The PreferredCustomer class should have properties for the amount of the customer's purchases and the customer's discount level. Demonstrate the class in a simple application.

I would really appreciate any help. Only in C#(visual studio) please.

Explanation / Answer

#include <string>

using namespace std;

#ifndef PERSON

#define PERSON

class PersonData

{

       protected:

                  string lastName;

                  string firstName;

                  string address;

                  string city;

                  string state;

                  string zip;

                  string phone;

      public:

                 void setLastName(string l);

                 string getLastName();

                 void setFirstName(string f);

                 string getFirstName();

                 void setAddress(string a);

                 string getAddress();

                 void setCity(string c);

                 string getCity();

                 void setState(string s);

                 string getState();

                 void setZip(string z);

                 string getZip();

                 void setPhone(string p);

                 string getPhone();

};

#endif

#include "personData.h"

void PersonData::setLastName(string l)

{

    lastName = l;

}

string PersonData::getLastName()

{

    return lastName;

}

void PersonData::setFirstName(string f)

{

    firstName = f;

}

string PersonData::getFirstName()

{

    return firstName;

}

void PersonData::setAddress(string a)

{

    address = a;

}

string PersonData::getAddress()

{

    return address;

}

void PersonData::setCity(string c)

{

    city = c;

}

string PersonData::getCity()

{

    return city;

}

void PersonData::setState(string s)

{

    state = s;

}

string PersonData::getState()

{

    return state;

}

void PersonData::setZip(string z)

{

    zip = z;

}

string PersonData::getZip()

{

    return zip;

}

void PersonData::setPhone(string p)

{

    phone = p;

}

string PersonData::getPhone()

{

    return phone;

}

#include "PersonData.h"

#include <ostream>

using namespace std;

#ifndef CUSTOMER

#define CUSTOMER

class CustomerData : public PersonData

{

    private:

        int customerNumber;

        bool mailingList;

    public:

        void setCustomerNumber(int c);

        int getCustomerNumber();

        void setMailingList(bool m);

        bool getMailingList();

        friend ostream& operator<<(ostream & out, const CustomerData & c)

        {

            out << "Name: " << c.firstName << " " << c.lastName << endl;

            out << "Address: " << c.address << endl;

            out << "City ST, zip: " << c.city << " " << c.state

                << ", " << c.zip<< endl;

            out << "Phone: " << c.phone << endl;

            out << "Customer Number: " << c.customerNumber << endl;

            if(c.mailingList == true)

                out << "Mailing List: Yes" << endl;

            else

                out << "Mailing List: No" << endl;

            return out;

        }

};

#endif

#include "customerData.h"

void CustomerData::setCustomerNumber(int c)

{

    customerNumber = c;

}

int CustomerData::getCustomerNumber()

{

    return customerNumber;

}

void CustomerData::setMailingList(bool m)

{

    mailingList = m;

}

bool CustomerData::getMailingList()

{

    return mailingList;

}

#include <iostream>

using namespace std;

#include "customerData.h"

int main()

{

    string temp;

    int i;

    char c;

    CustomerData bob;

    cout << "Input the customer's first name: ";

    cin >> temp;

    bob.setFirstName(temp);

    cout << "Input the customer's last name: ";

    cin >> temp;

    bob.setLastName(temp);

    cin.ignore(100, ' ');

    cin.clear();

    cout << "Input the customer's address: ";

    getline(cin, temp);

    bob.setAddress(temp);

    cout << "Input the customer's city: ";

    getline(cin, temp);

    bob.setCity(temp);

    cout << "Input the customer's state: ";

    getline(cin, temp);

    bob.setState(temp);

    cout << "Input the customer's zip: ";

    cin >> temp;

    bob.setZip(temp);

    cout << "Input the customer's phone number: ";

    cin >> temp;

    bob.setPhone(temp);

    cout << "Input the customer's member id number: ";

    cin >> i;

    bob.setCustomerNumber(i);

    cout << "Does the customer want to be on the mailing list? Enter y or n: ";

    cin >> c;

    if(c == 'y' || c == 'Y')

        bob.setMailingList(true);

    else

        bob.setMailingList(false);

    cout << "Your customer information: " << endl;

    cout << bob << endl;

    return 0;

}

class PreferredCustomer

{

       private:

                  double total;

                  double discount;

       public:

                  double get purchasesAmount();

                  double get discount();

                  double setpurchasesAmount(double t);

                  double set discountLevel(double d);

double PreferredCustomer::getpurchasesAmount()

{

        total = t;

        return t;

}

double PreferredCustomer::getdiscountLevel()

{

        discount = d;

        return d;

}

double PreferredCustomer::setPurchasesAmount(double t)

{

}

double PreferredCustomer::setdiscountLevel(double d)

{

       if(total >= 500)

       {

               cout << "You get a 5% discount." << endl;

        }

       if(total >= 1000)

       {

               cout << "You get a 6% discount." << endl;

        }

       if(total >= 1500)

       {

               cout << "You get a 7% discount." << endl;

        }

        if(total >= 2000)

       {

               cout << "You get a 10% discount." << endl;

        }

       if(total >= 0)

       {

               cout << "Invalid amount!" << endl;

        }

       else

               cout << "You do not get a discount. << endl;

#include "preferredCustomer.h"

double t;

double d;

cout << "What is the total amount of all of your purchases? ";

cin >> t;

cout << PreferredCustomer.setdiscountLevel << endl;

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