Reference no: EM133751795
Programming and Algorithms
Assessment Purpose:
The purpose of this assignment is to assess your progress towards attainment of a selection of the learning objectives as covered up to week 7. On successful completion of this assignment, you should have demonstrated that you are able to:
Write a program consisting of multiple objects which interact with each other by following appropriate design practices
Write a program that provides the requested functionality for the system
Utilise appropriate collection classes from Java's Collections API in appropriate ways/places
Read data from and write data to text files
Handle exceptions by constructing try ... catch blocks for appropriate circumstances
Design a text-based user interface
Assessment topic:
In this assignment, you will create a Java software package to process the records of books in a library according to the given instructions/commands. Your Java software MUST provide ALL the following functionalities:
Instructions for Library Management System
Add a Record
To add a book record to your library system, use the following format:
add title The Great Gatsby; author F. Scott Fitzgerald; ISBN 9780141182636; genre Fiction; year 1925
This instruction adds or updates a record for a book with:
Title "The Great Gatsby"
Author "F. Scott Fitzgerald"
ISBN "9780141182636"
Genre "Fiction"
Year of publication "1925"
If the ISBN matches an existing record in your library system, the existing record will be updated with the new information provided (e.g., genre, year).
Otherwise, the system adds the new valid record to the library system.
Delete Record(s)
To delete record(s) from your library system by title, use the format:
delete title The Great Gatsby
This instruction deletes the record(s) with the title "The Great Gatsby" from the library system.
To delete record from your library system by ISBN, use the format:
delete isbn 9780141182636
This instruction deletes the record with the isbn "9780141182636" from the library system.
Query Records
To query records in your library system by title, author, genre, or ISBN, use the format:
query title The Great Gatsby query author F. Scott Fitzgerald query genre Fiction
query ISBN 9780141182636
Each query retrieves books that match the specified criteria. The query results are saved to a report file for later reference.
Save Results to Files
The instruction save does the following:
Save the resulting data collection after executing add and delete instructions into a specified output file.
Save the query results to a separate report file.
If there are multiple "query" commands, append the latest query results to the end of the report file.
Separate the results of different query instructions using dashed lines with query instructions.
Sample Data and Instructions
Sample Data (books.txt)
Title: The Great Gatsby Author: F. Scott Fitzgerald ISBN: 9780141182636
Genre: Fiction Year: 1925
Title: Pride and Prejudice Author: Jane Austen
ISBN: 9780141439518
Genre: Romance Year: 1813
Title: To Kill a Mockingbird Author: Harper Lee
ISBN: 9780061120084
Genre: Fiction Year: 1960
Instructions (instructions.txt)
add title War and Peace; author Leo Tolstoy; ISBN 9780140447934; genre Novel; year 1869
add title Harry Potter and the Sorcerer's Stone; author J.K. Rowling; ISBN 9780590353427; genre Fantasy; year 1997
delete title Pride and Prejudice query title To Kill a Mockingbird query author F. Scott Fitzgerald save
Explanation
Add Records
Instruction: add title War and Peace; author Leo Tolstoy; ISBN 9780140447934; genre Novel; year 1869
This instruction adds a new book record:
Title: War and Peace
Author: Leo Tolstoy
ISBN: 9780140447934
Genre: Novel
Year: 1869
Instruction: add title Harry Potter and the Sorcerer's Stone; author J.K. Rowling; ISBN 9780590353427; genre Fantasy; year 1997
This instruction adds another new book record:
Title: Harry Potter and the Sorcerer's Stone
Author: J.K. Rowling
ISBN: 9780590353427
Genre: Fantasy
Year: 1997
Delete Record
Instruction: delete title Pride and Prejudice
This instruction deletes the book record with the title "Pride and Prejudice" from the library system.
Query Records
Instruction: query title To Kill a Mockingbird
This query retrieves the book record(s) with the title "To Kill a Mockingbird".
Instruction: query author F. Scott Fitzgerald
This query retrieves the book record(s) authored by "F. Scott Fitzgerald".
Save Results to Files
The resulting data collection after executing add and delete instructions can be saved into a specified output file (output.txt).
The query results for each query instruction can be saved to a separate report file (report.txt). If there are multiple query commands, append the latest query results to the end of the report file and separate results of different queries using dashed lines.
Example Output
Output File (output.txt) after executing add and delete instructions
Records updated successfully.
Report File (report.txt) after executing query instructions
Query: title To Kill a Mockingbird
Title: To Kill a Mockingbird Author: Harper Lee
ISBN: 9780061120084
Genre: Fiction
Year: 1960
Query: author F. Scott Fitzgerald
Title: The Great Gatsby Author: F. Scott Fitzgerald ISBN: 9780141182636
Genre: Fiction Year: 1925
What do you need to submit?
All java source Code
Report:
The following sections:
Section 1: UML class diagram to show your design
Section 2: screen shots of your code to show some examples of adding comments to your code;
Section 3: screen shots of your code to show some examples of how to handle exceptions;
Section 4: screen shots of your running program with at least 5 test cases to show examples of adding, deleting, updating and querying.