$29
For this homework assignment, please use templates to implement the Booklist class (Homework 6) so that both strings and integers are supported by the class.
The new Booklist class should be able to use either integers or strings, but you only have to implement support for book names (strings) in the main function. You can assume that all book names will be one word with the first letter capitalized.
Make sure all of your functions work. The sort functions should sort the books by alphabetical order. If your Booklist class functions were implemented correctly before, you should not need to make too many changes to them in order to support strings. For class templates to work, you will need to have the class functions in the same file as the class function declarations (you can just put it all in the .h file).
Make sure you take advantage of class and function templates so that both integers and strings would be supported (although you only need to use the class template for Booklist<string> in the main function).
The declaration in the main function can be like:
Booklist<string> list;
For example, the sample output can be:
Welcome to the book list program for book names.
What would you like to do?
1. add an element to end of list
2. add an element at a location
3. find an element by book name (linear search)
4. find an element by book name (binary search)
5. delete an element at position
6. delete an element by book name
7. sort the list (using selection sort)
8. sort the list (using bubble sort)
9. print the list
0. exit
1
Please type in the element
POLAND
The list is: POLAND
What would you like to do?
1. add an element to end of list
2. add an element at a location
3. find an element by book name (linear search)
4. find an element by book name (binary search)
5. delete an element at position
6. delete an element by book name
7. sort the list (using selection sort)
8. sort the list (using bubble sort)
9. print the list
0. exit
2
Please type in the element
SPRING
At what position?
1
The list is: SPRING POLAND
What would you like to do?
1. add an element to end of list
2. add an element at a location
3. find an element by book name (linear search)
4. find an element by book name (binary search)
5. delete an element at position
6. delete an element by book name
7. sort the list (using selection sort)
8. sort the list (using bubble sort)
9. print the list
0. exit
1
Please type in the element
MOUSE
The list is: SPRING POLAND MOUSE
What would you like to do?
1. add an element to end of list
2. add an element at a location
3. find an element by book name (linear search)
4. find an element by book name (binary search)
5. delete an element at position
6. delete an element by book name
7. sort the list (using selection sort)
8. sort the list (using bubble sort)
9. print the list
0. exit
7
Sorting the list using selection sort
The list is: MOUSE POLAND SPRING