Search for question
Question

Assignment 2 1. Introduction You are required to implement a basic Java program using Java SE 17 or later. This assignment is designed to: • Evaluate your ability to develop desktop applications using JavaFX. Evaluate your skills in storing persistent copy of data. Test your knowledge to implement OO design patterns. 3. Background This assignment builds on Assignment 1. You will build a GUI application for Burrito King Restaurant. The core business logic (e.g., adding orders, calculating preparation time, printing out sales report) remains the same as for Assignment 1. For Assignment 2, suppose you are a customer of the restaurant, not the manager. A sample solution of Assignment 1 will be provided, which you can use as reference. 4. Task Specifications Basic functional requirements are listed below. • The application can have many users. • Each user can create a profile, with a unique username, password, and first and last name. • Once the username and password are created, the user can log in. • • Each user is shown a dashboard after login. The dashboard should display the user's first name, last name, and any active order that has not been picked up by the user. For each active order displayed in the dashboard, show an order summary, including order number, ordered food items, total price, and order status (See below). Each user can perform the following actions: о Edit profile (change first name/last name/password, username is not changeable) Add food items to shopping basket. The program can guide the user to place the order by selecting food items (burritos, fries, and soda) and specifying quantity. The program allows the user to update the shopping basket (e.g., removing food items, updating quantity) as long as the user has not checked out. Place a new restaurant order. A user will be notified of the total price and the waiting time before placing the order. Once confirmed by the user, proceed to payment, where you collect (fake) credit card information (card number, expiry date, and cvv). (Do not use real credit card numbers!) You will need to perform simple validation to check (1) if the card number has 16 digits; (2) if the expiry date is a future date; (3) if cvv has 3 digits. For simplicity, you can assume the payment will be successful. Once an order is placed, a unique order number will be generated and assigned. The GUI should also ask the user to specify a "fake" time at which the order is placed. View all orders. The user can view the following details of all orders: day and time that the order was placed, total price of the order, and status of the orders. The status can be "await for collection", "collected" and "cancelled". The orders should be displayed in the reverse order of time they were placed. Collect an order. This will move an order status from "placed" to "collected". The GUI must allow the user to enter a "fake" time at which the order is collected. Note that collect-time must be at least order-placed time + time to prepare. An order that has been cancelled can not be collected. Cancel an order. A user can cancel an order that has not been "collected". After an order has been cancelled it can no longer be "collected". о Export all orders. The user should be able to export the historical orders to a file. The user should be able to select which orders to export. The user should be able to select the destination of the file and specify the file name. The user should be able to select what order information (e.g., ordered items or price) to be exported. The saved file should be in csv format. о Log out. There are more advanced features for VIP users. When a new user is registered, the user is a non-VIP user by default. Once a non-VIP user logs in, the user has the option of upgrading to a VIP user. To upgrade, the application asks if the user agrees to receive promotions: Would you like to receive promotion information via email? The user will become a VIP once they agree and provide a valid email address. Then the user can access VIP functionalities: Please log out and log in again to access VIP functionalities. A VIP user has the following additional functionalities: • Ordering a meal (a burrito, one serve of fries, and a soda), with a discount of $3. • Collecting credits for all orders. The user can earn one credit for each dollar spent. • Use credits when paying for orders. The program should ask the user if he/she wants to redeem credits when checking out. If yes, ask the user to specify the number of credits to redeem. Every 100 credits can be used as one dollar. If credits are redeemed in payment, the final order price of this order should be recorded as the actual amount paid by user. In other functionalities, the final order price will be used. For example, when "Viewing all orders", user will only see the actual price paid for that order. In "Collecting credits", the user can collect credits for the actual paid amount. 5. Assessment Details This assignment is structured around three milestones: in-lab design check in week 10, full program submission in week 12, and post-submission interview in week 14. It is recommended for you to follow the stages below to incrementally build the GUI application. But you can also plan the work in your own way, i.e., you do not have to do the tasks in the order listed. 5.2 Part A (In-Lab design milestone - Week 10) This milestone aims to assess your ability to define classes, establish relationships among them, and create a blueprint for the program's implementation. For this milestone, you are required to design the structure of your program. Specifically, you need to identify the necessary classes required for your application. For each class, you need to identify key data attributes and methods. You also need to determine the relationships among the classes (e.g., association, aggregation, composition, and inheritance). For this milestone, you will prepare a documentation of your program design with a clear description of classes and class relationships. While you don't need to strictly follow this design as you progress to later stages, you should propose a program design that reflects your current understanding to the best of your ability at this stage. You may use UML notation if you are familiar with that (e.g., from SEF) or you may just provide skeleton class definitions in Java. 5.3 Part B Following your class design in 5.2 Part A, you will work on the backend part of the application (excluding data storage, which will be covered in Part D). You will implement the key functionalities mentioned in the task specification based on Assignment 1. 5.4 Part C You will work on the frontend part of the application in this stage. You will design the user interface of the program that serves the program functionality. You will connect the frontend with the key functionalities from Part B, e.g., rendering data in a clean, concise, user-friendly format in the graphical interface. 5.5 Part D (Full program submission - Week 12) You will connect the front-end and back-end to build a functional program. You will use JDBC to store program data, so that the application can be restarted in the same state it was in the end of the previous execution. You will incorporate OO principles to design and optimize classes. 6. General Requirements This section summarizes the general requirements of Assignment 2 in four aspects: (1) GUI; (2) Functionality; (3) Program Design; and (4) Others. Please refer to Canvas -> Assignment 2 -> Rubric for detailed mark allocation. 6.1 GUI • • Your program should include appropriate JavaFX components to make the application easy- to-navigate. For example, each window should have a window title; menu options (if applicable) are selected from a menu bar. You will not be judged on the quality of your GUI design so long as it is clear how to use/navigate it. Your GUI should respond clearly to every user's action. For example, if the user types an incorrect password, the login window should display a clear error message and ask the user • • to type again. The GUI should also indicate when an action/operation is successful (e.g. "order successfully placed"). Your program should provide visual consistency. Avoid using different styles and labels for similar elements on different windows of the application. The GUI design of your program should serve the purpose of the application. 6.2 Functionality All functions required by specification are implemented correctly covering different cases that might happen during the usage of the program. 6.3 Program Design Appropriate choice of data structures that serves the purpose of the application. Class designs that adhere to the SOLID principles. • • • • • You are required to follow MVC pattern to connect the frontend with the backend. You are required to use one of design patterns such as Singleton pattern, besides the MVC pattern. You are required to implement at least one interface or abstract class to demonstrate your understanding of OO principles. You are required to apply SOLID principles when appropriate in order to enhance the maintainability and extensibility of your program, decrease coupling amongst classes, and minimize code repetition across classes. You are required to choose appropriate data structures to enhance the running efficiency of the program. 6.4 Others • • High source code quality with adequately commented and properly indented codes and appropriate class/method/variable names. Regular commitments to GitHub to show the progress of program development.