java面向对象代写 java编程代写 java OOD代写
CSIT121/CSIT821 - Object Oriented Design and Programming
Assignment 2 (10points)
Due on week 8 Friday 08/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 application using object-oriented programming approach. You are required to follow all object-oriented techniques when developing the system. This includes using the concept of encapsulation, abstraction, inheritance, and polymorphism.
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 9 lab or week 10 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 9 lab or week 10 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 1, 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.
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)
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.
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.
Consider the below images show the UML diagrams of the classes that need to complete the Core level.
The above diagram is the assignment 1 improved version. It can be changed or modified but you must include the interfaces to your design.

