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

C++ Project Name: IC25_CustomerData Design a class named PersonData with the fol

ID: 3766160 • Letter: C

Question

C++ Project Name: IC25_CustomerData

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 - The customerNumber variable will be used to hold a unique integer for each customer.
• mailingList - 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.

The CustomerData class should also maintain a static variable to keep track of the total number of customers created and a static function to access that number.

Write appropriate accessor and mutator functions for these member variables.
Demonstrate an object of the CustomerData class in a simple program.

Explanation / Answer

#include<iostream.h>
#include<conio.h>
int c=0;
class PersonData
{
public:
   char lastName[20];
   char firstName[20];
   char address[20];
   char city[20];
   char state[20];
   char zip[10];
   char phone[10];
};

class CustomerData : public PersonData
{
public:
   int customerNumber;
   bool mailingList;
   static int count;
   void add()
   {
       cout<<"Enter Lastname";
       cin>>lastName;

       cout<<"Enter Fastname";
       cin>>fastName;
       cout<<"Enter Address";
       cin>>address;
       cout<<"Enter City";
       cin>>city;
       cout<<"Enter State";
       cin>>state;
       cout<<"Enter Zip";
       cin>>zip;
       cout<<"Enter Phone";
       cin>>phone;
       c++;
   }

   void disp()
   {
       cout<<"Lastname "<<lastName;

       cout<<"Fastname "<<fastName;
       cout<<"Address "<<address;
       cout<<"City "<<city;
       cout<<"State "<<state;
       cout<<"Zip "<<zip;
       cout<<"Phone "<<phone;

   }

};

void main()
{
   CustomerData o[3];
   int i;
   for(i=0;i<3;i++)
   {
       cout<<"Enter Details of "<<i+1<<"Customer";
       o[i].add();
   }
   cout<<"Total number of Customer added are = "<<c;

   for(i=0;i<3;i++)
   {
       cout<<"Details of Customer "<<i+1<<"are"<endl;
       o[i].disp();
   }
}

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