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

You MUST use 1-­dimensional arrays, dynamic memory allocation, scoped enumeratio

ID: 3732041 • Letter: Y

Question

You MUST use 1-­dimensional arrays, dynamic memory allocation, scoped enumerations, and at least three user-­defined functions. For instance, you could use one for the menu and one for each task but the design is up to you.

Task Details

Your program will be a menu-driven application. The program will display a menu of choices to the user and based on the user’s response will perform one of the tasks below:

Welcome to Party Inc’s RSVP system! Please choose one of the menu options below:

Add event

Add Guest List

View Guest List

Change RSVP status

Quit

Enter choice here:

For tasks 1, 2, and 3 perform the task and then display the menu again giving the user an opportunity to make an additional choice. This should continue until the user chooses the ‘quit’ choice.

Add event

The RSVP system only needs to keep track of one event at a time. When the program starts the first step is to add the details for the event to be tracked. Ask the user to enter a theme, location, date, and size (number of guests allowed).

Add Guest List

Ask the user to enter the names associated with each available invitation (size of event). If the user enters more names than available invites, provide an error message. Use two parallel one-­dimensional arrays to contain the invitee’s name and response. The first one-­dimensional array should contain a pointer to a dynamically allocated string containing the invited person’s name. The second one-­ dimensional array should contain a scoped enum that determines if the invitee’s RSVP status is a “yes”, “no”, “maybe”, or “no response” for the event. If an invitation is not assigned, the name array will contain a null pointer (nullptr) and the RSVP array should contain the enum for “no response”.

View Guest List

Display the list of invited guests and their RSVP status.

Change RSVP status

Ask the user for a user’s name and the RSVP status you wish to update the user to. You will need to search for the user’s name and update the RSVP array accordingly.

Explanation / Answer

here is your program : -------->>>>>>>>

#include<iostream>

using namespace std;

enum status{
yes,
no,
maybe,
noresponse
};
typedef struct eventType{
string theme;
string location;
string date;
int size;
}Event;

void addEvent(Event &eve){
system("cls");
cout<<" Enter The Theme of the event : ";
cin>>eve.theme;
cout<<" Enter The Location of the event : ";
cin>>eve.location;
cout<<" Enter The Date(mm-dd-yyyy) of the event : ";
cin>>eve.date;
cout<<" Enter The No of guest Allowed for the event : ";
cin>>eve.size;
}
void initialize(int n,string **name,status **st){
*name = new string[n];
*st = new status[n];
}
void addGuest(string **name,status **stat,Event &eve,int &count){
if(name == nullptr || stat == nullptr){
  if(eve.size == 0){
   addEvent(eve);
  }
  initialize(eve.size,name,stat);
}
string ch = "y";
string nm;
while(ch[0] == 'y'){
  cout<<" Enter name Of the Guest ";
  cin>>nm;
  if(count >= eve.size){
   cout<<" Guest List is full ";
   return;
  }
  (*name)[count].reserve(20);
  (*name)[count] = nm;
  (*st)[count] = noresponse;
  count++;
  cout<<" want to enter Another Guest (y,n) ? ";
  cin>>ch;
}
}

void display(string *name,status *st,int count){
cout<<endl;
for(int i = 0;i<count;i++){
  cout<<"Name : "<<name[i]<<" Status : ";
  if(st[i] == yes){
   cout<<"yes ";
  }else if(st[i] == no){
   cout<<"no ";
  }else if(st[i] == maybe){
   cout<<"maybe ";
  }else{
   cout<<"noresponse ";
  }
}
}

void changeStatus(string *name,status *st,int count){
string nam;
string stt;
cout<<" Enter The name of Guest : ";
cin>>nam;
for(int i = 0;i<count;i++){
  if(name[i] == nam){
   cout<<" enter Status : (yes,no,maybe) ? ";
   cin>>stt;
   if(stt == "yes"){
    st[i] = yes;
   }else if(stt == "no"){
    st[i] = no;
   }else if(stt == "maybe"){
    st[i] = maybe;
   }
   break;
  }
}
}

void menu(){
system("cls");
cout<<" 1. Add Event";
cout<<" 2. Add Guest List";
cout<<" 3. Display Guest List";
cout<<" 4. Change RSVP status ";
cout<<" 5. Quit";
cout<<" choose : ";
}

int main(){
Event eve;
string *name = nullptr;
status *stat = nullptr;
int count = 0;
int ch = '0';
while(ch != 5){
  menu();
  cin>>ch;
  switch(ch){
   case 1:
    {
     addEvent(eve);
     initialize(eve.size,&name,&stat);
     break;
    }
   case 2:
    {
     addGuest(&name,&stat,eve,count);
     break;
    }
   case 3:
    {
     display(name,stat,count);
     break;
    }
   case 4:
    {
     changeStatus(name,stat,count);
     break;
    }
  }
  cin.get();
  cin.ignore();
  cin.clear();
}
}