Question: Problem Statement: This program will read books from an input file into your library data structure. A library consists of a list of books that

Problem Statement:

This program will read books from an input file into your library data structure. A library consists of a list of books that can be in sorted or unsorted order. As books are read in from the input file, just add them to an internal array that holds books. You will provide two methods on this Library for sorting books after they are read in from the data file. One sort function should sort by the publication year of the books. The other should sort by the author of the book. One of your sorts should be written using SELECTION SORT. The other should be written with MERGESORT. You must write your own sort code. Do not use any built in C++ libraries for sorting.

Requirements:

You must be able to add books to your Library using an add method.

You must be able to sort your books in two manners using appropriate methods.

You must be able to display the books in the library after sorting using a print or display method.

You are not required to delete books from the list.

You must prompt the user for the name of an input file to read the books from.

Your list must be able to store at least 100 books. (Use arrays, not linked lists, - so that you can write a mergesort).

You may display your lists to the screen or to an output file. It is your choice. If you use an output file, allow the user to enter the name of the file.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sample Output:

We The Living

Rand, Ayn

1936

The Sparrow

Russell, Mary Doria

1996

Foundation

Asimov, Isaac

1951

Hyperion

Simmons, Dan

1989

The Fifth Season

Jemison, N. K.

2015

Kindred

Butler, Octavia

1979

Watership Down

Adams, Richard

1972

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sample Execution:

Welcome to the book manager. Please enter the name of your input data file:books.txt

The Library Sorted by YEAR is:

TITLE: We The Living

BY: Rand, Ayn

YEAR: 1936

TITLE: Foundation

BY: Asimov, Isaac

YEAR: 1951

TITLE: Watership Down

BY: Adams, Richard

YEAR: 1972

TITLE: Kindred

BY: Butler, Octavia

YEAR: 1979

TITLE: Hyperion

BY: Simmons, Dan

YEAR: 1989

TITLE: The Sparrow

BY: Russell, Mary Doria

YEAR: 1996

TITLE: The Fifth Season

BY: Jemison, N. K.

YEAR: 2015

The Library Sorted by AUTHOR is:

TITLE: Watership Down

BY: Adams, Richard

YEAR: 1972

TITLE: Foundation

BY: Asimov, Isaac

YEAR: 1951

TITLE: Kindred

BY: Butler, Octavia

YEAR: 1979

TITLE: The Fifth Season

BY: Jemison, N. K.

YEAR: 2015

TITLE: We The Living

BY: Rand, Ayn

YEAR: 1936

TITLE: The Sparrow

BY: Russell, Mary Doria

YEAR: 1996

TITLE: Hyperion

BY: Simmons, Dan

YEAR: 1989

End program 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!