Question: PLEASE ONLY POST COMPLETED CODE. Code in Java and leave comments. Also, avoid using HashMaps, HashSets or HashTables. Thank you! Functionality: This time the main

PLEASE ONLY POST COMPLETED CODE. Code in Java and leave comments. Also, avoid using HashMaps, HashSets or HashTables. Thank you!

Functionality: This time the main menu should look like: **Welcome to the Comets Books and DVDs Store** Please select your role: A store manager B customer C exit store ****************************************************************************** If Option A is entered, the program will then prompt the user to enter credentials, like shown below: Please enter your username: xxxxx Please enter your password: yyyyy Valid credentials are stored in a credentials file, which will be a plain text file called credentials.txt. The file will have the following format: , // username and password are separated by a comma You can assume this file will be placed in the same directory as your source code when it is being graded. Thus, when testing locally, that is where you should place your version. Your program should look up in the given credentials file for the correct username and password; if no match is found in the file, the program should provide a response to the User such as Unrecognized Credentials and present the main menu again. You cannot assume that the file will only have one set of credentials, i.e., there may me multiple store managers. In this case, each set of credentials will appear on a new line in the file. If the authentication is successful, the program should display the catalog section as developed in assignment 3, with one addition option 7 in the menu as shown below. **Welcome to the Books and DVDs Store (Catalog Section)** Choose from the following options:

1 Add Book 2 Add AudioBook 3 Add DVD 4 Remove Book 5 Remove DVD 6 Display Catalog 7 Create backup file 9 Exit Catalog section If option 7 is entered, your program will save all current catalog items and their attributes into a text file, named as catalog_backup_.txt where the current date and time is the time the backup file being created (the file should be created in the current directory, i.e., the directory where your source is being run from). For example, if option 7 is entered at 2017-11-15-19:45:32 then the backup file should be named as catalog_backup_2017_11_15_19_45_32.txt. You can use the Date class and SimpleDateFormat Class in Java to get the formatted date and time. If Option 9 is selected, the program will return to the main menu for role selection. In addition to the original requirements from Assignment 3, each Item also has a private discount of type double the corresponding getter and constructor methods need to be updated accordingly. Use 0.9, 0.5, and 0.8 as the discount values for Book, AudioBook, and DVD. ****************************************************************************** If Option B is selected, the program should display the menu for shopping section (assignment 2). In this project, the shopping cart should be implemented using list, instead of array in assignment 2. In addition, the menu should look like follow: Choose from the following options: 1 - Browse books inventory (price low to high) 2 - Browse DVDs inventory (price low to high) 3 - Add a book to the cart 4 - Add a DVD to the cart 5 Delete a book from cart 6 Delete a DVD from cart 7 - View cart 8 - Checkout 9 Done Shopping Continue this looping until option 9 is selected. When option 9 is entered, return to the main role selection menu. If Option 1 or 2 is entered, list the book / dvd inventory in the order of price low to high as assignment 2, however the price should be the discounted price (see the discounts above). Discounted prices also apply to when viewing the cart and checking out (i.e., options 7 and 8). The behavior for the other options stay the same. ****************************************************************************** If Option C is selected, the program gracefully terminates. Design Considerations: (Data/Input) Validation has been a continual aspect of all our assignments. Often the validation code has been duplicated. This time we have a requirement to try and stay as DRY as possible. Thus, you will need to create a class called Validator which implements an interface as follows: o The interface is called Acceptable you must create this interface and include it as part of your code. The interface will have the methods: boolean isNonEmptyString (String s); boolean isPositiveInput (double d); o Your Validator class will implement this interface and define the methods to perform these checks. You are free to add more methods as appropriate. o Your code will use your validator to do all the input validation such that the appropriate methods can simply be called and all the duplicated code will reside in the Validator class. We will be sorting Items based on price for this assignment, but that does not mean we should be directly comparing the prices of two items. Instead our Items will implement the Comparable interface such that we can compare objects directly to see which one is larger/smaller. The logic to decide which one is larger or smaller will be in the compareTo method. All the code to handle File Input/Output should also be in its own class, exposing methods as appropriate, such that the calling code need just invoke the right methods, passing in the necessary arguments.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!