The Booklist class — Homework 11 Solution

$30.00 $24.00

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…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)

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

  1. add an element at a location

  1. find an element by book name (linear search)

  1. find an element by book name (binary search)

  1. delete an element at position

  1. delete an element by book name

  1. sort the list (using selection sort)

  1. sort the list (using bubble sort)

  1. print the list

  1. exit

Please type in the element

POLAND

The list is: POLAND

What would you like to do?

  1. add an element to end of list

  1. add an element at a location

  1. find an element by book name (linear search)

  1. find an element by book name (binary search)

  1. delete an element at position

  1. delete an element by book name

  1. sort the list (using selection sort)

  1. sort the list (using bubble sort)

  1. 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

  1. add an element at a location

  1. find an element by book name (linear search)

  1. find an element by book name (binary search)

  1. delete an element at position

  1. delete an element by book name

  1. sort the list (using selection sort)

  1. sort the list (using bubble sort)

  1. print the list

  1. exit

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

  1. add an element at a location

  1. find an element by book name (linear search)

  1. find an element by book name (binary search)

  1. delete an element at position

  1. delete an element by book name

  1. sort the list (using selection sort)

  1. sort the list (using bubble sort)

  1. print the list

  1. exit

Sorting the list using selection sort

The list is: MOUSE POLAND SPRING

The Booklist class --- Homework 11 Solution
$30.00 $24.00