“C++”编程代写 "C++"程序代写 "C++"代写
CSIT121/CSIT821 - Object Oriented Design and Programming
Assignment 3 (10points)
Due on week 11 Friday 29/05/20 by 5 PM
The purpose of this assignment is to practice OOP programming covering Abstraction, Encapsulation,
Inheritance, Polymorphism, Interface, Exception, File I/O and Collection Framework.
In this assignment, a student required to develop a Java Swing GUI application using object-oriented programming approach (do not use drag-drop auto-generated code in the Netbeans). All object-oriented techniques used in the development of the system in the previous assignment will be used in this assignment.
CSIT121 students: This assignment has two levels: core (up to 8 marks) and standard (up to 10 marks). The assignments may be audited in the week 12 lab or week 13 lab if it is needed. All assignments must also be submitted to Moodle by the due date; otherwise, you may reward with zero marks.
CSIT821 students: This assignment has two levels: core (up to 6 marks) and advanced (up to 10 marks). The assignments may be audited in the week 12 lab or week 13 lab if it is needed. All assignments must also be submitted to Moodle by the due date; otherwise, you may reward with zero marks.
Note that students will need to complete the core level first before attempts to complete the next level.
Consider the following scenario:
An airline company want to create an online air ticket purchase for its customers. The company want to attract customers to participate or purchase tickets from its website by offering a discount to the registered customer via a frequent flyer card (e.g. for an airline such as Quntos). It uses to get some discount when purchasing the ticket on the company online website. The company also offers a discount coupon every year calculating from the frequent flying point and the number of year that he/she join the membership. There are two kinds of store cards: a platinum card and a titanium card.
Note that the below statements are the description of the previous requirement in the assignment 2, and it will be carried over to use in this assignment as well.
A frequent flyer card has the following attributes/requirements:
- id (10 digits of number used to identify the card)
- name (a customer's full name)
- address (an object of a class that contains a street number, street name, suburb, city, state and postcode) - frequent flying point (FFP) – the default is 0 for the new card.
- date of activation.
A platinum card has the additional attributes/requirements besides the attributes in the above: -discount is fixed at 1% for the economy class ticket and 5% for the business class or first-class ticket.
The customer earns points when they purchase the ticket. The FFP is the total points of all purchases made by the customer.
Besides the attributes/requirements in frequent flyer card, a titanium card also has:
- years (a value that calculates from the date of creation)
- discount is fixed at 2% for the economy class ticket and 10% for the business class or first-class ticket.
Hints: For years, it is a number of years that a titanium card has been activated and used. It should be design as a method rather than an attribute.
At the end of each year, each customer will receive a discount coupon (e.g. a coupon for $100 means they can a discount of up to $100 of the purchased air ticket price on the company’s online website). However, the rules for a coupon value generation for a platinum card and a titanium card are different.
CSIT121 © Pairat Thorncharoensri 2020
Platinum card coupon rules:
- if the FFP is less than 10000 points, then the yearly coupon (in A$) is 0.5% of the FFP points - if the FFP is more than 10000 points, then the yearly coupon (in A$) is 1% of the FFP points
Titanium card coupon rules:
- if the FFP is less than 100,000 points, then the yearly coupon (in A$) is 1.5% of the FFP points
- if the FFP is between than 100,000 to 300,000 points, then the yearly coupon (in A$) is 2% of the FFP points - if the FFP is more than 300,000 or the years is more than five years with the FFP points between 100,000 to 300,000 points, then the yearly coupon (in A$) is 3% of the FFP points
The attribute detail of air ticket class is as follows: -Ticket ID
-Name
-Departure City
-Destination City
-Flight Number
-Ticket Type (use Enum to construct with the type code and name. It should have at least three types: EconomyClass, BusinessClass and FirstClass )
-Price
-DiscountType (use Enum to construct with the type code and name. It should have at least two types: Card Discount and Coupon Discount)
-Discount amount
The attribute detail of address is as follows: -street number
-street name
-suburb
-city -state -postcode
The example of coupon class can be designed as follows: -id (use to identify the coupon)
-value (the discount amount)
In the shopping cart, an interface named “Discount” is used to get a discount from a card or a coupon.
This interface provides the following methods:
- getDiscountAmount( double amount, TicketType type): With the purchased amount and the type of the air ticket as input, it returns the amount of the discount values depending on the type of discounts whether it is Card or coupon (a coupon may not need to use this input but it should follow the interface method).
- getDiscountId: it returns the id of coupon or voucher or card.
Note that the following statement and UML are new requirements for this assignment. Please feel free to change the above requirement if needed to suit the following requirements.
A new customer (who doesn’t have a frequent flyer card) can do online registration to log into the system by supply the following details.
-username (with a minimum of 5 characters)
-password (with a minimum of 8 characters at least one upper capital, one lower capital and one number)
- name (a customer's full name)
- address
After the online registration process, the new user online account with a Platinum card will be created. (Hints: it creates both User and Flyer Card object at the same time)
An existing customer, who holds a frequent flyer card by applying it via an offline registration process, but has not yet had an online account can create the user online account for log into the system by supply the following details
CSIT121 © Pairat Thorncharoensri 2020
-username (with a minimum of 5 characters)
-password (with a minimum of 8 characters)
-card id (check whether it exists or not before process the registration)
After the online registration process, the new user online account will be created and link to the existing frequent flyer card.
Consider the below images show the UML diagrams of the classes that need to complete the Core level.
The above diagram was carried over from Assignment 1. It can be changed or modified, but you must include the interfaces to your design. You may access the moodle site to get the code for the above UML diagram.
CSIT121 © Pairat Thorncharoensri 2020
Some of the design was carried over from Assignment 2. The marks of this assignment will be assigned to only new classes or methods in the above diagram.
Note that the design of classes/attributes/methods in the above UML diagrams can be changed and it is up to your judgement. Some of the above design diagrams may contain some typos or wrong type or not reasonable methods. You may correct/change it as well.
Core Level Requirements (up to 8 marks for CSIT121 students; up to 6 marks for CSIT821 students)
From the above design, write the code for the following tasks:
Ensure that your classes are well designed with practical attributes (either primitive type, class object or Enumerated Data type) and have proper methods to handle all tasks (Encapsulation). Students are allowed to add any classes or attributes or methods to the design if it is necessary to perfect the design.
CSIT121 © Pairat Thorncharoensri 2020
Main Goal of this Core level:
1. Create new flyer card using GUI 2. Query a flyer card by ID or name.
Task 1(GUI I): (1 mark)
Design CardAndUserInformationDisplayPage class (extend from JFrame or JPanel). You may choose to design everything in the constructor of the class or follow the above design or design everything on your own. The goal is to allow the system to use this class to display information about cards in the text area. It also allows the user to navigate back to the main page.
Task 2 (GUI II) : (1 mark)
Design CardQueryPage class (extend from JFrame or JPanel). You may choose to design everything in the constructor of the class or follow the above design or design everything on your own. The goal is to allow the system to use this class to obtain the information of the card (either id or name) and return it back to the system. It also allows user to navigate back to the main page.
Task 3 (GUI III): (2 marks)
Design CardRegisterPage class (extend from JFrame or JPanel). You may choose to design everything in the constructor of the class or follow the above design or design everything on your own. The goal is to allow the system to use this class to obtain the information for creating a new card (i.e., id, name and address) and return them back to the system (as List object or array of String or Map). It also allows the user to navigate back to the main page.
Task 4 (CardAndUserRegisterSystem): (2 marks)
Design CardAndUserRegisterSystem class. You may choose to design everything following the above design or design everything on your own. The goal is to create a card registration and enquiry system to use the above three classes (in Task 1-3) as View in MVC. The following conditions are required.
1. The system should provide a method that allows the user to navigate back to the main page. (0.2 marks)
2. The system should provide a method that opens a page to query the information for creating a new card from a user. The system may get back the data via another method in this class and process it to create a new card and add it to the system. After register the new card, it should display the card information on the window (via CardAndUserInformationDisplayPage). (0.9 marks)
3. The system should provide a method that opens a page to query the information to search for a card from a user. The information may be Card id or name. The system may get back the data via another method in this class and process it to search for a card with the given input information. After obtaining the card, it should display the card information on the window (via CardAndUserInformationDisplayPage). (0.9 marks)
Task 5 (GUI IV-MainPage): (1 mark)
Design MainPage class (extend from JFrame or JPanel). You may choose to design everything in the constructor of the class or follow the above design or design everything on your own. The goal is to allow the system to use this class to present the menu to a user. A user can choose to create a new card or search for a card or exit the application.
Task 6 (MainSystem): (1 mark)
Design MainSystem class. You may choose to design everything following the above design or design everything on your own. The goal is to this system to connect a user to the card register and enquiry system. The following conditions are required.
1. If the user chooses to create a new card then it will connect to the card registration and enquiry system to create a new card. (0.4 marks)
2. If the user chooses to search for a card then it will connect to the card registration and enquiry system to search the card. (0.4 marks)
3. This card should provide a method that helps to navigate back to the main menu in the MainPage. (0.4 marks)
CSIT121 © Pairat Thorncharoensri 2020
Note that all classes should override and implement the toString methods to transform the information of the object into the string variable. Please do not use "System.out.print" in the classes excepted for testing. Please write each class in each java file (do not write them all in one file).
To prepare the Word document file for submission, please create the new word document and input your information such as name, student id, and lab class identification (id or day/time). Next, copy the code from the Java files one by one to the Word document file.
Make sure your submission includes your NetBeans project (compress all folders and files into a zip file before submitting it) to Source Code submission link on the Moodle site and the UML diagram and codes on the word document (.doc) to Word Document submission link on the Moodle site (for code similarity analysis).
Note that all assigned marks will be reduced to 75% for CSIT821 students. For example, one mark is equal to 0.75 marks for CSIT821 students, and 0.5 marks are equal to 0.375 marks for CSIT821 students.
Standard Level Requirements (up to 10 marks)
Design and draw a UML diagram, and write the code for the following additional requirements: The standard level includes all the requirements of the core level plus the following features:
The code for Ticket class and TicketPuchasesRecord classes are provided on the Moodle site.
CSIT121 © Pairat Thorncharoensri 2020
Standard level Task 1: MainSystem and MainPage Class (0.2 marks)
Modify MainSystem class. You may choose to design everything following the above design or design everything on your own. The goal of this class is to this system to connect a user to the ticket purchasing system. The only condition is to allow a user to create a ticket via MainSystem. You will also need to provide a new menu in the MainPage.
Standard level Task 2: TicketDisplayPage. (0.2 marks)
Design TicketDisplayPage class (extend from JFrame or JPanel). You may choose to design everything in the constructor of the class or follow the above design or design everything on your own. The goal of this class is to allow the system to use this class to display the ticket’s information in the text area. It also allows the user to navigate back to the main page.
Standard level Task 3: TicketPurchasePage. (0.4 marks)
Design TicketPurchasePage class (extend from JFrame or JPanel). You may choose to design everything in the constructor of the class or follow the above design or design everything on your own. The goal of this class is to allow the system to use this class to obtain the information for creating a ticket and ticket-discount purchasing record and return them back to the system (as List object or array of String or Map). It also allows the user to navigate back to the main page.
Standard level Task 4: TicketPurchaseSystem. (0.4 marks)
Design TicketPurchaseSystem class. You may choose to design everything following the above design or design everything on your own. The goal of this class is to create a ticket purchasing system. It uses the TicketDisplayPage and TicketPurchasePage classes in Task 2 and 3 to interact with the user. It takes input from the user to create a ticket and its ticket-discount record. If the discount id is presented for the discount, then it will send a request for the discount type and discount amount from the card registration system via the main system.
Standard level Task 5: (Serialization) Read and Write Binary File. (0.8 marks)
Read/Write Ticket and TicketPurchaseRecord objects from/to binary files. Do the following steps to Read/Write the objects to a binary file.
1. Implement serializable to Ticket and TicketPurchaseRecord classes. (0.1 marks)
2. Write the ReadFile method in the TicketPurchaseSystem to read a binary file and convert it to
object using ObjectInputStream. (0.3 marks)
3. Write the WriteFile method in the TicketPurchaseSystem to write objects to a binary file using
ObjectOutputStream. (0.4 marks)
Advanced Level Requirements (up to 10 marks for CSIT821)
The advanced level includes all the requirements of the core (6 marks) and the standard level (2 marks) plus the following features and classes:
CSIT121 © Pairat Thorncharoensri 2020
Advanced level Tasks:
1. Modify the CardAndUserRegisterSystem class follow the above diagram. (0.5 marks).
2. Modify the MainSystem and MainPage classes follow the above diagram (0.4 marks).
3. Design User and UserCardRecord classes follow the above diagram. (0.4 marks).
4. Design the UserRegisterPage class follow the above diagram. The goal is to allow a user to create
an online user account. It should have a page to create a new user along with a new card or a new user with an existing card. (0.7 marks)
Students who wish to submit an advanced or standard assignment must ensure that they have already met all the core requirements.
Note that you must submit your Java project (zip your project directory with data files) to Source Code Submission Link. You also need to submit a word document file that contains all source codes and other required items (i.e., UML diagram) to Word Document Submission Link on Moodle site before the due date.
CSIT121 © Pairat Thorncharoensri 2020
Marking Rubric:
For each task, the marks will be awarded according the following criteria.
Correctness
The application should produce the correct result as stated in the specification.
10%
Documentation
A proper description of each class, variable and methods in the code should be provided. Use An appropriate name for each variable or method in the code. The usage of each method is expected.
10%
Class/ method design
Effectively design and demonstrate an understanding and appreciation of the concepts of a well-structured solution and right coding style within object-oriented programming principles. Use appropriate library classes in Java to construct the program.
30%
Completeness of the implementation
Properly implement all Classes/methods that need according to the stated requirements. Use a proper technique in OOP or design pattern to implement the solution. Beware and use an appropriate structure/ hierarchy for classes. For test code class, the important methods should be tested with a proper input argument. Some instances of classes should be created and tested. Relationship between the class should be tested if needed.
50%
CSIT121 © Pairat Thorncharoensri 2020

