Programming assignments are to be written individually and submitted programs must be the result of your own efforts. Any suspicion of cheating will be dealt with accordingly. The minimum punishment I will impose for Academic integrity violation will be a 0% on the programming assignment and a 2-letter grade reduction in the course. Please refer to the following site for additional details, as it is your responsibility to be aware:
Important: I reserve the right to revisit program grades after completion of semester and final exams. If there is a marked discrepancy in program grades and your answers to related questions on tests, this will be challenged and appropriate grade adjustments given. In addition, appropriate measures will be taken with respect to the University’s policy on Academic Integrity where indicated as a result of the outcome of such a challenge.
Purpose: This assignment is designed to demonstrate your understanding of the creation, compilation, and program submission process we will be using this semester.
In this assignment you will create a program for a book store. You are the owner of a book store. You have the following information available in your stock (information is stored in the form of parallel arrays):
For this program, you will be given a text file which contains the data of all the books in the bookstore with their price and ID. Your first task will be getting to read the text file and storing the information in form of parallel arrays or ArrayLists.
Once you have the arrays, make a display() method that displays the following menu:
1) Purchase Menu
2) Add a book to Inventory
3) Remove a Book from Inventory
Enter your choice:_
If Option 1 is selected: For this option, you will display all the Book ID, Book Title and Book Price information to the user in a tabular format. Your program should then ask the user for the Book ID and the number of books the user wishes to purchase. Based on the Book ID provided by the user,
● If the Book ID is not found, display a message saying the book does not exists. The book ID needs to be searched based on linearSearch() or binarySearch() (if you have both, then you need to show another menu to let the user choose between the two types of searches).
● If the Book ID is found, then display the Book ID, Book Title, Number of books bought and total cost of this purchase and prompt the user to confirm the purchase.
The program must then go back to the main menu until the user decides to quit.
(If you implement the Binary Search, then you will get an additional 10 points granted it works correctly.)
If Option 2 is selected: For this option, you will have to add a new book to the inventory. The user is asked to enter a Book ID, Book Title and Book Price. Once the user enters all three, add the information to the arrays or array list and then also update the text file given to you. By doing this, your new books will remain even after you close the program.
NOTE: There should not be duplicate Book IDs. If a user enters a Book ID which already exists, then the program must prompt the user to enter a different ID until the user enters a valid ID.
If Option 3 is selected: For this option, you will have to remove an existing book from the inventory. You will ask the user to enter a Book ID. If the Book ID is valid, then remove the contents of the book from the array or array list and update the text file. This way, you will not have to remove books every time you run the program.