Design and implement aprogram in C++ FORMAT to manage acourse database using par
ID: 3617444 • Letter: D
Question
Design and implement aprogram in C++ FORMAT to manage acourse database using parallel arrays.
Course informationconsists of a course number, the last name of the instructor, andits room capacity.
In your program, you mustuse parallel arrays (three arrays) to store this data. You mayassume
Main menu: Inthe beginning, the program must prompt the user to select an optionfrom the
menus below (1 – 4). If the user selects aninvalid option, the program prints an errormessage
and displays the main menu again.
Mainmenu:
1.Enter new course information
2.Search a course by course number
3.Print a list of courses sorted by the coursenumber
4.Exit
Option 1: Ifthe user selects 1, then the program asks the user to enter newcourse information
(0 to exit) and stores this information into parallelarrays. You may assume that the arrays are
still empty. After the user enters 0, the programdisplays the main menu again.
1.Enter new course information
Course number (0 to exit): Math115
Instructor: Smith
Capacity: 80
Course number (0 to exit): Math111
Instructor: Doe
Capacity: 100
Mainmenu:
1.Enter new course information
2.Search a course by course number
3.Print a list of courses sorted by the coursenumber
4.Exit
Option 2: Ifthe user selects 2, then the program asks the user to enter acourse number. If the
input course number is found in the database, theprogram displays the course information.
Otherwise, the program prints a message that thecourse is not found. After that, the program is
back to the main menu.
2.Search by course number
Please enter a course number: Math115
CMPT115 is found in the database.
Instructor: Smith
Mainmenu:
1.Enter new course information
2.Search a course by course number
3.Print a list of courses sorted by the coursenumber
4.Exit
Yourselection: 3
number. After that, the program displays the mainmenu.
3.Print a list of courses sorted by the coursenumber
Course number: Math111
Instructor: Doe
Capacity: 100
Course number: Math115
Instructor: Smith
Mainmenu:
1.Enter new course information
2.Search a course by course number
3.Print a list of courses sorted by the coursenumber
4.Exit
Option4: If the user selects 4,then the program terminates.
Explanation / Answer
please rate - thanks #include using namespace std; int menu(); void printmenu(); void enter(int &,string[],string[],int[]); void search(int ,string[],string[],int[]); void sort(int ,string[],string[],int[]); int main() { string course[100],prof[100]; int cap[100],choice,count=0; choice=menu(); while(choice!=4) {switch(choice) {case1:enter(count,course,prof,cap); break; case2:search(count,course,prof,cap); break; case3:sort(count,course,prof,cap); break; } choice=menu(); } return 0; } void sort(int n,string c[],string p[],int cap[]) {int i,j,t; string st; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.