For this assignment you are required to write a program that implements a simple Used Car Warehouse Database System. This section specifies the required functionality of the program. The aim of the Used Car Warehouse Database System is for a warehouse to keep a database of the used car, and to perform operations such as searching for cars, adding/deleting cars, displaying the details of cars, etc.
FIT9131 Assignment 2 FIT9131 Semester 2 2017 Assignment 2 6 September 2017 1 Used Car Warehouse Database System Due Date : 12 noon on Friday in Week 12 (20 October 2017) Introduction This assignment is worth 25% of the marks for your final assessment in this unit. Heavy penalties will apply for late submission. This is an individual assignment and must be entirely your own work. You must attribute the source of any part of your code which you have not written yourself. Please read the section on plagiarism in this document. The assignment must be done using the BlueJ environment. All user input to the system, and system output to the user, must be done at the BlueJ terminal window. No other graphical interfaces are to be used (nor assessed) in your program. The Java source code for this assignment must be implemented according to the FIT9131 Java Coding Standards. Any points needing clarification should be discussed with your tutor in the tutorial class. You should not make any assumptions about the program without consulting with your tutor. Specification For this assignment you are required to write a program that implements a simple Used Car Warehouse Database System. This section specifies the required functionality of the program. The aim of the Used Car Warehouse Database System is for a warehouse to keep a database of the used car, and to perform operations such as searching for cars, adding/deleting cars, displaying the details of cars, etc. The Used Car Warehouse Database System should provide the following features : • maintains a list (using a Java Collection class) of Car objects o each Car object represents a single “car” o each “car” should contain the following information: ▪ Registration Number (e.g. 8RT2WT) ▪ Year Made (e.g. 2013) ▪ Colour (e.g. white). A car can have up to 3 different colours. ▪ Car Make (e.g. Toyota) ▪ Car Model (e.g. Corolla) ▪ Price (e.g. $15000) o cars can be added/deleted (or for the HD level, edited) from the list FIT9131 Semester 2 2017 Assignment 2 6 September 2017 2 • lists the details of an existing car (or cars) • produces a report of cars based on some criteria • loads a list of cars from a text file • saves the list of current cars to a text file You are to demonstrate the following programming techniques in your program : • reading/writing data from/to text files • using appropriate Java Collection class or classes to store data • using code to manipulate the data in the collection(s) • performing simple searches, filtered by some given criteria • using program constructs such as repetitions & selections • using appropriate classes to represent objects in the program There will be a description of the “HD level” features later in this document (in the Grades section). You are also required to produce a partial Test Strategy for your program. FIT9131 Semester 2 2017 Assignment 2 6 September 2017 3 Program Logic When the Used Car Warehouse Database System starts, it should automatically load a text file called "usedcars.txt" which contains details of all used cars currently kept by the warehouse. The actual format of this text file is described later in this document. The data loaded should be stored in some appropriate data structures. No other reading from or writing to file is required while the program is in operation, until the user chooses to exit, at which point the program saves all the data in memory back to the same text file (usedcars.txt). In other words, the file I/O operations are performed automatically by the program, and require no direct interactions with the user. When the program is running, it should repeatedly display the main menu with these options: (1) Search Cars (2) Add Car (3) Delete Car (4) Exit System Option (1) of the main menu allows the user to search for cars in the database. The user should be asked what criteria(s) he/she wants to use to search for cars. The following sub-menu and options should be displayed: Car Searching Options: (1) By Registration Number (2) By Car Make and Car Model (3) By Age (4) By Price (range) (5) Back to Main Menu Inputs other than 1-5 (e.g. 0, x, abc, @#$% etc.) should be rejected, and an error message should be printed. The menu should be displayed repeatedly, until the user chooses Option (5). • If the user chooses option (1), you should ask the user to input a registration number. A valid registration number should only contain maximum 6 characters combination of English alphabet or digit (that is, “A”-“Z”, “a”-“z” or “0-9”). If the input contains any invalid character (e.g. empty space, “#”, “&”, “\” etc.) or more than 6 characters, an error message should be displayed and ask the user for another valid input. If it is a valid input, search the database for any car with the specific car registration number. Display all information of this car if found, or display “No such car with this Registration Number” if not found. FIT9131 Semester 2 2017 Assignment 2 6 September 2017 4 • If the user chooses option (2), you should ask the user to input a Car Make first. A valid Car Make should only contain English alphabet or digit. If the input contains any invalid character (e.g. empty space, “#”, “&”, “\” etc.), an error message should be displayed and ask the user for another valid input. If it is a valid input, ask the user to input a Car Model. The same validity checking applies. The user can input a Car Model (e.g. “Corolla”) or “ANY”. If “ANY” is inputted, the program should display all car models of this Car Make from the database. Display all information of cars with this Car Make and this Car Model (or all Car Models if “ANY” is inputted) if found, or display “No such car with this Car Make and Car Model” if not found. • If the user chooses option (3), you should ask the user to input a non-negative integer (e.g. 0, 1, 5, 12 etc.) to indicate the maximum age of cars he/she wants to search. A validity checking should be applied here. Display all information of cars with this maximum age if found, or display “No such car with this maximum age” if not found. For example, if the user inputs 0, all cars made in 2017 should be displayed. If the user inputs 3, all cars