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

Can someone please help me with the pseudocode for this program? A. Define a cla

ID: 3863458 • Letter: C

Question

Can someone please help me with the pseudocode for this program?

A. Define a class named Family in a header file named: family.h (prototype)

B. Create the implementation file family.cpp

The class will have the following members

Family name

Parent (array of 2) (

First Name

Last Name

Age

Children (array of 10)

First Name

Last Name

Age

The class will be able to add parents or children

The class will be able to return information on parents and children.

C. Create the program Lab05b.cpp which uses the class Family to Implement the following

The program will allow the user to

Add families

With one or two parents (3 points)

With zero or more children (3 points)

Delete Families search by last name (should use the same search

function from item 3 below. (1 point)

Display Families searching by last name (2 points)

Display a list of all families

I can't can't further than this so far:

Header file:

<CODE>

#pragma once

#ifndef FAMILY_H

#define FAMILY_H

#include <string>

#include <iostream>

class Family

{

private:

char familyName;

char parentName[20];

int parentAge;

char childName[20];

int childAge;

public:

void setParentAge(int);

void setParentName(char[20]);

const int getParentAge();

const char* getParentName();

void setChildAge(int);

void setChildName(char[20]);

const int getChildAge();

const char* getChildName();

};

#endif

</CODE>

Explanation / Answer

#include <iostream>
#include <list>
#include <vector>
#include <string.h>
using namespace std;

struct Person{
     char* FN; char* LN; int age;
};

class Family {
    private:
    char* name;
    Person parent[2];
    Person children[10];
    public:
    void setName(char* n);
    char * getName();
    void setParent(char FN[], char LN[], int a, int i );
    void setChildren(char FN[], char LN[], int a, int i);
};

void Family::setName(char n[]){
    name = n;
}

char* Family::getName(){
    return name;
}
void Family::setParent(char FN[], char LN[], int a, int i ){
    parent[i].FN = FN;
    parent[i].LN = LN;
    parent[i].age = a;
}
void Family::setChildren(char FN[], char LN[], int a, int i ){
    children[i].FN = FN;
    children[i].LN = LN;
    children[i].age = a;
}

char printMenu();
void addFamily(std::list<Family*> list);
void printAll(std::list<Family*> list);
void prinFamily(std::list<Family*> list,char * n);
void deleteFamily(std::list<Family*> list,char * n);
int main()
{
    std::list<Family*> mylist;
    std::list<Family*>::iterator it;
    cout << "" << endl;
    char c = '*';
    while(c != 'Q'){
        c = printMenu();
        if(c=='A'||c=='a'){
           addFamily(mylist);
        }
        if(c=='D'||c=='d'){
            char* name;
            cout << "Enter Name to Delete :";
            cin >>name;
            deleteFamily(mylist,name);
        }
        if(c=='P'||c=='p'){
            char* name;
            cout << "Enter Name :";
            cin >>name;
            prinFamily(mylist,name);
        }
        if(c=='L'||c=='l'){
           printAll(mylist);
        }
        if(c=='q'){
            c ='Q';
        }
    }
    return 0;
}

void printAll(std::list<Family*> list){
    std::list<Family*>::iterator it;
    for (it = list.begin(); it!=list.end(); it++) {
        cout << "Name: "<<(*it)->getName()<<endl;
    }
}
void prinFamily(std::list<Family*> list,char * n){
    std::list<Family*>::iterator it;
    for (it = list.begin(); it!=list.end(); it++) {
        char* name = (*it)->getName();
        if(strcmp(name,n)==0){
            cout << "Name: "<<(*it)->getName()<<endl;
            break;
        }
    }
    cout << "Not found"<<endl;
}
void deleteFamily(std::list<Family*> list,char * n){
    std::list<Family*>::iterator it;
    for (it = list.begin(); it!=list.end(); it++) {
        char* name = (*it)->getName();
        if(strcmp(name,n)==0){
            delete *it;
            break;
        }
    }
    cout << "Not found"<<endl;
}
void addFamily(std::list<Family*> list){
  
    Person* p = new Person;
    Family* f = new Family;
    char* name;
    int numOfP;
    cout << "Enter Name :";
    cin >> name;
    f->setName(name);
    cout << "Enter Number of Parent :";
    cin >>numOfP;
    for(int i =0;i<numOfP;i++){
        char* fname;
        char* lname;
        int age;
        cout << "Enter Parent First Name :";
        cin >>fname;
        cout << "Enter Parent Last Name :";
        cin >>lname;
        cout << "Enter Parent Age :";
        cin >>age;
        f->setParent(fname,lname,age,i);
    }
    cout << "Enter Number of Child :";
    cin >>numOfP;
    for(int i =0;i<numOfP;i++){
        char* fname;
        char* lname;
        int age;
        cout << "Enter Child First Name :";
        cin >>fname;
        cout << "Enter Child Last Name :";
        cin >>lname;
        cout << "Enter Child Age :";
        cin >>age;
        f->setChildren(fname,lname,age,i);
    }
    list.push_front(f);
}

char printMenu(){
    char choice;
    cout << " [A] Add Family "<< endl;
    cout << " [D] Delete Family "<< endl;
    cout << " [P] Display By Name "<< endl;
    cout << " [L] Display all "<< endl;
    cout << " [Q] Quit"<< endl;
    cout << "Choose an option :";
    cin >> choice;
    return choice;
}