An airline company wants to create an online air ticket

An airline company wants to create an online air ticket purchase for its customers. The company wants to attract customers to participate or purchase from its website by offering a discount to the registered customer via a frequent flyer card (e.g. for an airline such as Quotes). It uses to get some discount when purchasing the ticket on the company’s online website. There are two kinds of store cards: a platinum card and a titanium card.

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 a 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 since a titanium card has been activated and used. It should be designed 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 on the purchased air ticket price on the company’s online website). However, the rules for 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 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)

-Price

-DiscountType (use Enum to construct with the type code and name)

-Discount amount The attribute detail of the address is as follows:

-street number

-street name

-suburb

-city

-state

-postcode

Design and draw a UML diagram, and 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.

Task 1:

Design (Class Code and UML).

1. Design the system and draw a UML diagram.

2. Write the java code for the frequent flyer card class in the above scenario. 

3. Design and write the java code for the subclasses of frequent flyer cards. 

4. Design and write the java code for the air ticket class, DiscountType, and TicketType Enum. 

5. Design and write the java code for the address class.

Task 2:

The frequent flyer card, coupon, ticket classes should be able to provide methods as follows.

1. A method named “getDataToSaveToTextFile” output all attributes in the object to a String that can be used to write it to a CVS format file directly,

e.g. “1222354444, Peter Pace,2/15, Smith Street,Wollongong,Wollongong,NSW,2500,0,11/2/18 3224354545, Henry Potter,13, Kamble Street,Wollongong,Wollongong,NSW,2500,0,14/2/20”.

2. A static method named “getInstanceFromStringArray” with the input of String Array outputs an object of the respective class.  Choose the appropriate input or/and output type for each method.

Task 3 (Test Code): write the test code (a separate class/file called “TestMethod” with the Main method in it) to test all the methods in all classes. You may start by creating the object of each class. For each object, call methods in Tasks 1 and 2 to check whether the method works properly. Display the output of the methods to the console. Finally, display information of all the objects to the console. 

Test Cases: Use objects created in classes to print out the output. You can input whatever data you want to make the program run.

Noted 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 except for the TestMethod class or View Class. Please write each class in each java file (do not write them all in one file).

 

Stressed over that homework?

Essay deadline breathing down your neck?

Let’s cut to the chase: Why struggle when you can ace it with zero hassle?

Whether it’s essays, research papers, or assignments — we’ve got you covered.

✅ Expert writers
✅ 100% original work
✅ No AI tools, just real pros

Stressed about your essay or homework? Get a top-quality custom essay NOW!!! Stop worrying. Start succeeding.

GradeEssays.com
We are GradeEssays.com, the best college essay writing service. We offer educational and research assistance to assist our customers in managing their academic work. At GradeEssays.com, we promise quality and 100% original essays written from scratch.
Contact Us

Enjoy 24/7 customer support for any queries or concerns you have.

Phone: +1 213 3772458

Email: support@gradeessays.com

© 2024 - GradeEssays.com. All rights reserved.

WE HAVE A GIFT FOR YOU!

15% OFF 🎁

Get 15% OFF on your order with us

Scroll to Top