Question: Im learning OOP in Java. My question is: QUESTION 2 (30 MARKS) Given the following super class and subclasses publie abstract class Theme ParkTicket String
Im learning OOP in Java. My question is:


QUESTION 2 (30 MARKS) Given the following super class and subclasses publie abstract class Theme ParkTicket String name: Il customer's name String ielo 1/ customer's Identification card number boolean members // theme park menberonmember 1/default and normal constructor 1/accessors //toString Dublte abstract double ticketPricetta // calculate price public class WaterDarkTicket extends Theme ParkTicket String activity: 11 surfeach, waterRide or other 1/default and normal constructor 1/toString publie double ticket Price ) I/ACCESO publie clans Wildlife ParkTicket extends Theme Park seker char category: 1/c-child, dwadult, S-sensor 1/default and normal constructor //acces //toString() publie double ticket Price --> a) Write the following method definitions Normal constructor for both subclasses. (6 marks 3) ticketPrice () method based on the abstract method in superclass to calculate the price of the activities for both Water ParkTicket and Wildlife ParkTicket classes for a single ticket Customers who are members of the Theme ParkTicket will be given a special discount of 20% for every ticket charge. The details of ticket charges are given in Table 5.1 and Table 52 *) ticketPrice) method based on the abstract method in superclass to calculate the price of the activities for both Water ParkTicket and W2011 feParkTicket classes for a single ticket. Customers who are members of the Theme ParkTicket will be given a special discount of 20% for every ticket charge. The details of ticket charges are given in Table 5.1 and Table 52 Table 5.1 Details of ticket charges for Water Park Activity Cost (RM) Surf Beach 40.00 Water Rides 25.00 10 00 Other Table 5 2 Details of ticket charpes for Wadife Park Category Cost (RM) Senior 15.00 Adult 35.00 Chid 15.00 marks) b) Assuming that all relevant methods have been defined in all the three classes above, write code fragments in the driver class to do the following tasks only Declare an array of object named tpe to store various types of theme park tickets where the size of array is entered by the user 2 marks) Assuming data has been stored in this ept antay, calculate and display the total charges of every Water DarkTicketand wildlife ParkTicket Ticket respectively (5 marks) Print the list of adult customers in the wild life park and the total number of adults followed by the list of senior customers in the wild life park and the total number of senior citizens (8 marks) Tai ir
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
