Data Structures
CS 221
Dr. Leap
Fall, 1999
 Syllabus
 Outline
 Grades    

Library Card Catalog Search


The file /home/leap/cs221/book.dat contains a list of book titles, authors and call numbers for over 400 books in the library. This is a standard text file with one book per line in the file. The first 20 characters on the line are the call number, the next 25 characters on the line are the author and the remainder of the line is the book's title which might be up to 150 characters long. Write a class that can be used to store this list of books, or even a larger list, using a doubly linked, circular list. The records in the list should consist of three information fields: call number, author and title. The class should have member functions to perform the following functions:

  • A constructor that will initialize the list to empty. This constructor should be called if there is no parameter (initial value) given when an object of this type is created.
  • A second constructor (overloading) that will be called if a string is given as an initial value for the object. This string should be taken as the name of the file of books that should be read into the list.
  • A destructor that will remove all nodes from the list and delete them.
  • A function that will return the call number, author and title of the current book.
  • A function to advance the current book to the next book in the list.
  • A function to backup to the previous book in the list and make it the current book.
  • A function to return the call number, author and title of the current book.
  • A function to delete the current book from the list.
  • A function to insert a new book after the current book.
  • After the file has been read into the list, your program should clear the terminal screen and then display a program title, centered on the line at the top of the screen. Centered approximately vertically on the screen should be three labels on three lines double spaced with the descriptions of the three fields. At the bottom of the screen should be a prompt for a command and a command summary just above it. The commands that should be accepted are:

    • E or X or Q: Exit the program

    • A: Perform a search for a particular author, the author's name should be prompted for and the number of books by that author should be displayed. If only party of a name is entered then all books with an author beginning as entered should be included.

    • C: Perform a call number search allowing all books to be examined in the order that they occur in the file.

    • K or W: Perform a key word search. The key word should be prompted for and accepted then all books with that word in their title should be included.

    • N or +: Advance to the next book in the list and display it.

    • P or -: Move back to the previous book in the list and display it.

 
   
HomeFacultyProgramsStudentsOpportunities
Department LinksAffiliated ClubsFacilitiesResearchContact

About EtownAcademicsAdministrativeAdmissionsAlumni Relations
Etown SportsnetLibraryComputingNews @ EtownStudent Life


Copyright © 1999 Elizabethtown College
All Rights Reserved Maintained by Dr. Thomas Leap

Last updated on November 5, 1999 10:23:31