Professional Documents
Culture Documents
Group:A4CS2303A
Polymorphism
(6 marks)
ii) Processor method named calCharges() based on the abstract method in
superclass to calculate the charges of the activities for both WaterPark and
WildlifePark classes.
Name:Muhammad Hairil bin Shaharudin 2020834824
Group:A4CS2303A
iii) Customers who are members of the ThemePark will be given a special discount
of 25% for every ticket charge.
Name:Muhammad Hairil bin Shaharudin 2020834824
Group:A4CS2303A
The details of ticket charges are given in Table 5.1 and Table 5.2:
b) Write fragment codes in the application that can perform the following tasks: (Assume all
relevant methods have been defined in all classes involved)
i) Declare an array of object named tp to store various types of theme park where the size
of array is entered by the user.
Name:Muhammad Hairil bin Shaharudin 2020834824
Group:A4CS2303A
ii) Calculate and display the total charges of every WaterPark and
WildlifePark respectively
iii) Count and display the number of customer for each category of wild life park
and display the respective information about both adult and child using the toString()
method.
Name:Muhammad Hairil bin Shaharudin 2020834824
Group:A4CS2303A
Output: