COMP 130!”!Introduction to Programming with Java Final Makeup Exam, Fall 2012 Solved

$ 20.99
Category:

Description

!
Class:!!BookStore.java!
Write a program that reads a number of book records from a file and then responds to queries of the user by displaying the related book information. The program reads the book records from the text file “books.txt”, which keeps id, title and author of a book on each line. The file format is “id/title/author” for each book (hence the fields corresponding to id, title and author are delimited by “ / ”). While reading the file, the book records are stored in two separate hashmaps. The first one is to keep the titles, an HashMap<Integer,String>, where keys are book ids and values are titles. The second one is to store the authors, an HashMap<Integer,String>, where keys are book ids and values are authors.

After reading the book records from the file and storing them in the hashmaps, the program repeatedly asks user to enter a book id, and then returns the title and the author of the book with that id. If a book record does not exist with the provided id, then the program reports this. The program continues asking for book ids until a blank line is entered as input by the user. See the sample run below for specifics of the required output.

Sample Run:

Reviews

There are no reviews yet.

Be the first to review “COMP 130!”!Introduction to Programming with Java Final Makeup Exam, Fall 2012 Solved”

Your email address will not be published. Required fields are marked *