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

Your swim school has two swimming instructors, Jeff and Anna.Their current sched

ID: 3644440 • Letter: Y

Question

Your swim school has two swimming instructors, Jeff and Anna.Their current schedules are shown below.

These are the times they are busy, the possible time slots are 11-12,12-1,1-2,2-3
Jeff- Mon- 11-12, 2-3 Tues- 11-12,12-1,1-2,2-3 Wed- 12-1,1-2,2-3 Thurs- 12-1
Anna- Mon- 11-12,1-2,2-3 Tues- 11-12,12-1,1-2 Wed- 2-3 Thurs 11-12,12-12-3

Write a program with array(s) capable of storing theschedules. Create a main menu that allows the user to mark a timeslot as busy or free for either instructor. Also, add an option to output the schedules to the screen. Next, add an option to output all time slots available for individual lessons ( slots when atleast one instructor is free). Finally, add an option to output all time slots available for group lessons ( when both instructors arefree).

I know this is time consuming but please help, i am using microsoft visual C++ express 2010

Explanation / Answer

please rate - thanks

#include<iostream>
#include<iomanip>
#include <string>
using namespace std;
void set(char[][4],char[][4],char);
void output(char[][4],string);
void individual(char[][4],char[][4]);
void group(char[][4],char[][4]);
void getinfo(int&,int&,int&);
int main()
{char jeff[4][4],anna[4][4];
int i,j;
int choice=0;
for(i=0;i<4;i++)
   for(j=0;j<4;j++)
       {anna[i][j]=' ';
       jeff[i][j]=' ';
       }
while(choice!=6)
    {cout<<"Choose what you would like to do ";
     cout<<"1 Mark time slot busy ";
     cout<<"2 Mark time slot free ";
     cout<<"3 output time schedule ";
     cout<<"4 output time slots for individual lessons ";
     cout<<"5 output time slots for group lessons ";
     cout<<"6 Exit ";
      cin>>choice;
     switch(choice)
        {case 1:    set(anna,jeff,'X');
                   break;
         case 2:    set(anna,jeff,' ');
                   break;
         case 3:     output(anna,"ANNA");
                    output(jeff,"JEFF");
                    break;
         case 4:    individual(anna,jeff);
                   break;
         case 5:    group(anna,jeff);
                   break;
         case 6:     return 0;
                   break;
        default:    cout<<"Illegal input: Try Again ";
       }
       }
system("pause");
return 0;
}
void getinfo(int& who,int& day,int& slot)
{cout<<"Enter 1 for Anna, 2 for Jeff: ";
cin>>who;

while(who<1||who>2)
   {
   cout<<"invalid entry-re try ";
   cout<<"Enter 1 for Anna, 2 for Jeff: ";
   cin>>who;
   }
slot=5;
while(slot<0||slot>3)
   {
    cout<<"Enter time slot: ";
    cout<<"0 for 11-12 ";
    cout<<"1 for 12-1 ";
    cout<<"2 for 1-2 ";
    cout<<"3 for 2-3 ";
    cin>>slot;
    if(slot<0||slot>3)
        cout<<"Invalidentry ";
   }
day=5;
while(day<0||day>3)
   {
    cout<<"Enter day: ";
    cout<<"0 for Monday ";
    cout<<"1 for Tuesday ";
    cout<<"2 for Wednesday ";
    cout<<"3 for Thursday ";
    cin>>day;
    if(day<0||day>3)
        cout<<"Invalidentry ";
   }
}
void set(char a[][4],char j[][4],char what)
{int who,day,slot;
   getinfo(who,day,slot);
   if(who==1)
       a[slot][day]=what;
   else
       j[slot][day]=what;

}
void output(char p[][4],string name)
{int i,j;

cout<<endl<<setw(10)<<name<<"   Monday Tuesday Wednesday Thursday ";
for (i=0;i<4;i++)
{cout<<setw(2)<<(i-1+11)%12+1<<"-"<<(i-1+12)%12+1;
    for(j=0;j<4;j++)
      cout<<setw(11)<<p[i][j];
    cout<<endl;
   }
   cout<<endl;
}

void individual(char a[][4],char je[][4])
{char free[4][4];
int i,j;
for(i=0;i<4;i++)
   for(j=0;j<4;j++)
       if(a[i][j]==' '||je[i][j]==' ')
          free[i][j]='X';
       else
          free[i][j]=' ';
output(free,"Available");
}
void group(char a[][4],char je[][4])
{char free[4][4];
int i,j;
for(i=0;i<4;i++)
   for(j=0;j<4;j++)
       if(a[i][j]==' '&&je[i][j]==' ')
          free[i][j]='X';
       else
          free[i][j]=' ';
output(free,"Available");
}