Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions