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

There are a couple different parts to this I am awarding the maxium allowed poin

ID: 3556112 • Letter: T

Question

There are a couple different parts to this I am awarding the maxium allowed points.

a. Create a CustomerProfile class. Each CustomerProfile contains a last name, phone number, and bit fields indicating whether the customer:

--Works full time

--Owns a house

--Owns a dog

--Owns a computer

--Has a credit card

--Gives to charity on a regular basis

--Subscribes to magazines

b. Suppose an organization wants to solict homeowners to home improvement loans. Write a program that allows you to create an array of atleast 10 CustomerProfiles, then select homeowners and display them. Save as CusHomeowner.cpp

c. Using the same CustomerProfile class, write a program that allows you to select customers who own both a dog and a computer, so you can send them advertisement about a new pet-oriented website. Save as CusWithDogComp.cpp

Explanation / Answer

// (a)

class CustomerProfile
{
public:
string lastname;   
string phone;
unsigned short worksFullTime : 1; // ( 0 or 1)
unsigned short ownsHouse : 1; // ( 0 or 1)
unsigned short ownsDog : 1; // ( 0 or 1)
unsigned short ownsComputer : 1; // ( 0 or 1)
unsigned short hasCreditCard : 1; // ( 0 or 1)
unsigned short isCharitable : 1; // ( 0 or 1)
unsigned short subscribedMagazines : 1; // ( 0 or 1)
};


// (b)

void main()
{
CustomerProfile cp[10];
for (int j=0; j<10; j++)
{
cout << "Enter last name: ";
       cin >> cp[j].lastname;
       cout << "Enter phone: ";
       cin >> cp[j].phone;
       cout << "Works Full Time (0/1): ";
       cin >> cp[j].worksFullTime;
       cout << "Owns House (0/1): ";
       cin >> cp[j].ownsHouse;
       cout << "Owns Dog (0/1): ";
       cin >> cp[j].ownsDog;
       cout << "Owns Computer (0/1): ";
       cin >> cp[j].ownsComputer;
       cout << "Has Credit Card (0/1): ";
       cin >> cp[j].hasCreditCard;
       cout << "Gives to charity on a regular basis (0/1): ";
       cin >> cp[j].isCharitable;
       cout << "Subscribes to magazines (0/1): ";
       cin >> cp[j].subscribedMagazines;
}
   for (int j=0; j<10; j++)
{
       if(cp[j].ownsHouse==1){
           cout << cp[j].lastname;
       }
   }
}
// save this as CusHomeowner.cpp

// (c)
  
void main()
{
CustomerProfile cp[10];
for (int j=0; j<10; j++)
{
cout << "Enter last name: ";
       cin >> cp[j].lastname;
       cout << "Enter phone: ";
       cin >> cp[j].phone;
       cout << "Works Full Time (0/1): ";
       cin >> cp[j].worksFullTime;
       cout << "Owns House (0/1): ";
       cin >> cp[j].ownsHouse;
       cout << "Owns Dog (0/1): ";
       cin >> cp[j].ownsDog;
       cout << "Owns Computer (0/1): ";
       cin >> cp[j].ownsComputer;
       cout << "Has Credit Card (0/1): ";
       cin >> cp[j].hasCreditCard;
       cout << "Gives to charity on a regular basis (0/1): ";
       cin >> cp[j].isCharitable;
       cout << "Subscribes to magazines (0/1): ";
       cin >> cp[j].subscribedMagazines;
}
   for (int j=0; j<10; j++)
{
       if(cp[j].ownsDog==1 && cp[j].ownsComputer==1){
           cout << cp[j].lastname;
       }
   }
}
// save this as CusWithDogComp.cpp