Starting from:

$30

CSC30500 -  Project #1 - Solved

1           Objectives
•    Writing a file based database system

•    Becoming familiar with the needs for a true database system

2           Problem Statement
You will be writing a computer program that keeps track of libraries, books, and library holdings (of books.) Your program should essentially prompt the user to enter a one letter command, and process the command as follows:

•    a (for add), which should then read in one of:

–    b, which should then read a string (with no spaces) representing an ISBN, an integer representing a published year, a string (with no spaces) representing an author name, and then a string (possibly with spaces) representing a book title. So, the following:

a  b 654321 1999 Blythe C++ Rocks!

should add the book with ISBN 65432, published in 1999 by the author named Blythe, and titles C++ Rocks to the system.

–    l (i.e. lowercase ’L’), which should then read a string (with no spaces) representing the name of a library, another string (with no spaces) representing the city name for the library, and in integer representing the zip code for the library. So, the following:

a  l Boone Ellisville 63011

should add a library called Boone in the City of Ellisville with a zip code of 63011. .

–    h, which should then read a string (with no spaces in it) representing a library name and another string (with no spaces in it) representing an ISBN. This pair would represent a new book to add to the specified library. If the book is a new book in that library, it should be considered copy #1 of that book in that library. If it is the second time that the book has been added to the library, then it should be considered copy #2, and so on. So, the following:

a  h Boone 654321

should add a holding of the book with ISBN 654321 into the Boone library.

•    l (that is, the letter ’l’ for ”list”), which should then read in one of:

–    b, which should list all of the books, including ISBN number, published date, author name, and book title. The book does not have to be part of any library’s holdings to be in this listing (but the book could be part of a library’s holdings.)

–    l (lowercase ’L’), which should list all of the libraries, including the names, locations, and zip codes of each library.

•    f (for ”find”), which should also read in the ISBN of a book. It should then print out each library holding that matches this book, being sure to include the library name, the ISBN number, the publish date, the author name, the book title, and the copy number.

•    q (for ”quit”), which should stop the running program.

Some notes:

•    After processing one command, the program should continue to prompt the user for another command (and process what the user enters). This repeats until the user enters ’q’.

•    it should be possible to type the entirety of each “command” all on one lie as given in the above (and below) examples. Do NOT prompt for each sub-component. Doing such will cost you significant points.

•    Data should be persistent between runs! That is, if you add a course in one run, it should appear in another run without re-entering it in the subsequent run.

3           Example Execution
Suppose the first time you run the program, you do the following (>>> is the program’s prompt to the user):

>>> a b 654321 1999 Blythe C++ Rocks!

>>> a b 123456 2002 Blythe Java is Cool Beans!

>>> l b

654321 1999 Blythe C++ Rocks!

123456 2002 Blythe Java is Cool Beans!

Then, suppose you run the program again (possibly without stopping the above running program):

>>> a b 666 1991 Gates Windows for All

>>> l b

654321 1999 Blythe C++ Rocks!

123456 2002 Blythe Java is Cool Beans!

666 1991 Gates Windows for All

>>>q

Make careful note that neither Blythe book was entered during the second run, but still appeared! Also, note that an additional book was added, and suppose you continued with the first run (carefully realizing that no other additional books were explicitly added by the first run itself)

...

>>> l b

654321 1999 Blythe C++ Rocks!

123456 2002 Blythe Java is Cool Beans!

666 1991 Gates Windows for All

>>> a l Boone Ellisville 63011

>>> a l LARC Lindenwood 63301

>>> l l

Boone Ellisville 63011

LARC Lindenwood 63301

>>> a h 654321 Boone

>>> a h 654321 Lindenwood >>> a h 666 Lindenwood

>>> a h 654321 Lindenwood

>>> f 654321

Boone: 654321 1999 Blythe C++ Rocks! Copy Number: 1

Lindenwood: 654321 1999 Blythe C++ Rocks! Copy Number: 1

Lindenwood: 654321 1999 Blythe C++ Rocks! Copy Number: 2

>>> q

ng on this project yet? If not, then START NOW !!!!!

More products