Question: in java program Lab Exercise 3 FantasyLand is a newly opening theme park in Johor. It offers two (2) types of ticket which are annual
in java programLab Exercise 3 FantasyLand is a newly opening theme park in Johor. It offers two (2) types of ticket which are annual pass and daily pass. Given the following classes and inheritance hierarchy that shows the classes relationship Theme Park Annualpass DailyPass The folowing are definitions for the ThemePark, AnnualPass and DailyPass classes. public abstract class Theme Park private String dateissued; 1/date of ticket purchasing private int quantityAdult: /umber of adult ticket private int quantityChild; /umber of children ticket public Theme Park () {-} 1ormal constructor to //initializes all attributes public string getDate Issued()) // return date purchased public int getQuantityAdult() () //return number of adult ticket public int getQuantityChild() //return number of children //ticket public abstract double calculatePrice (); //end of class Theme Park public class Annualpass extends Theme Park private boolean nationality: //true if Malaysian, else false public Annual Pass (..) (...) /ormal constructor to //initializes all attributes public boolean get Nationality o//return nationality status public double calculatePrice () ...) 7 payment is calculated based on the following table: Category Malaysian Non Malaysian RM75.00 RM225.00 Child RM175.00 Adult RM125.00 17/end of class Annual Pass public class DailyPass extends Theme Park private int quantityseniorCitizen: /umber of senior citizen //ticket private boolean discount Coupons //true if the person has //discount coupon public DailyPass )-> /ormal constructor to //anitializes all attributes public int getQuantitysensor) //return number of senior //citizen ticket public boolean discount Coupon () { // return discount coupon //status public double calculateprice) 7 *payment is calculated based on the following table: Category Price Adult RX125.00 Child Senior Citizen RM95.00 101 discount will be given if the person has a discount coupon. W/end of class DailyPass Use the concept of polymorphism to perform the following tasks: a) Complete the class definitions above. b) Write an application class that will do the following: Declare an array named ticket of class Theme Park to store information of all tickets. . Read ali data from input file, ticket.txt and store them into the array List the date issued and total price that the customer needs to pay Count number of annual pass sold to Non-Malaysian citizen for both adult and children category, and output the total sales amount accordingly. Sample Input Sample Output 95.00 eft format View all 15/01/2019:5:13 AP: YES 21/11/2019:212DPI: NO 01/10/2019,220;DP: 2:YES 27/02/2019;211: AP:NO 15/01/2018 1000. 21/11/2010 27/02/2018 reco Annual Sold to som malayalam M children In S. Cl2 100% Wadow CHUTE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
