Question: QUESTION 2: (19 marks) Given the following classes and inheritance hierarchy: Safari DaySafari NightSafari public abstract class Safari { private String guestName; private String identificationNum;


QUESTION 2: (19 marks) Given the following classes and inheritance hierarchy: Safari DaySafari NightSafari public abstract class Safari { private String guestName; private String identificationNum; private Boolean isMalaysian; public Safari (String name, String ID, Boolean malaysian) ..://method definition) 11 accessor/retriever methods for each data member public String toString() 1 1/method definition] //method to update the balance for the account public abstract double totalCharges(); } Note: 15% Discount will be given from the total charges if the guest is a Malaysian. a) Define the DaySafari class that inherits from the Safari class. The attributes and methods are as follows: Attributes: category of guest (children, adult, senior) Methods: Normal Constructor toString(), to return the string representation of the object totalCharges(){ ... } adult= rm35 children= rm20 senior=rm25 accessor method for data member
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
