Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago