Question
In C++, create five parallel arrays that are to hold no more than 50 items in each array. These five parallel arrays must be the
These five parallel arrays must be the following:
- an unsigned short integer array named BookiD
- an unsigned long integer array named BookISBN
- a string array named BookTitle
- a string array named BookAuthor
- a double array named BookPrice
Write a menu based program implementing the following functions:
(0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following:
- a do/while loop with the displayMenu function call inside the loop body
- switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu.
- the do/while loop should always continue as long as the user does not choose to quit the program.
The functions below must each have their own menu option in which they correspond to. le. Menu Option # 1 to write data to the text file should be the first function, etC.
(1) Write a function that prompts the user for the name of a file to output as a text file that will contain the five parallel arrays data in the following format:
- First column of data must be the BookID
- Second column of data must be BookISBN
- Third column of data must be BookTitle
- Fourth column must be BookAuthor
- Fifth column must be BookPrice
The BookTitle and BookAuthor columns must have their data items terminated with a ; character to denote the end of the string data (see how we did this in the student records program in class).
(2) Write a function to prompt the user for the name of a file to input as a text file to read a text file that will contain the five parallel arrays data in the following format:
- First column of data must be the BookID
- Second column of data must be BookISBN
- Third column of data must be BookTitle
- Fourth column must be BookAuthor
- Fifth column must be BookPrice
The BookTitle and BookAuthor columns must have their data items terminated with a ; character to denote the end of the string data (see how we did this in the student records program in class).
After reading in the text file, have this function display the data in a tabular form with all five parallel arrays displayed in column form.
3. Write a function to display the contents of the five parallel arrays in column form (hint: you might want to have the function #2 call this function after loading the data from a text file).
4. Write a function to allow the user to enter data into the parallel arrays.
5. Write a function to allow the user to update data in the parallel arrays.
6. Write a function to sort the parallel arrays by book title in alphabetical order (sort in order A-Z).
7. Write a function to sort the parallel arrays by book author in alphabetical order (sort in order A-Z).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started