Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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) // accessor/retriever methods for each data member public String toString() { //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. c) Write a Java application class called SafariApp that uses the concept of polymorphism to perform the following tasks: i) Get input from the user regarding the number of data to be stored and information for each guest. ii) Calculate and display the total charges for all guest. Also, count number of guests for each category (DaySafari and Night Safari). iii) Display all guest details that choose fastlane package under Night Safari category. (9 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) // accessor/retriever methods for each data member public String toString() { //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. c) Write a Java application class called SafariApp that uses the concept of polymorphism to perform the following tasks: i) Get input from the user regarding the number of data to be stored and information for each guest. ii) Calculate and display the total charges for all guest. Also, count number of guests for each category (DaySafari and Night Safari). iii) Display all guest details that choose fastlane package under Night Safari category. (9 marks)

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

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago