Question: Please help me solve this question. Thank You! [Object-oriented programming] [Java] p/s: using Java Given the following hierarchy of superclass Patient and their subclasses; Inpatient

Please help me solve this question. Thank You! [Object-oriented programming] [Java]

Please help me solve this question. Thank You! [Object-oriented programming] [Java] p/s:

p/s: using Java

Given the following hierarchy of superclass Patient and their subclasses; Inpatient and Outpatient and the definition for each superclass and subclasses Superclasss: Loan public abstract class Patient { protected String name; protected long refid; protected boolean isMalaysia; /ame of patient //reference number //true for Malaysia //Methods: /ormal constructor //accessors; getName(), getRefID(), getMalaysia () //toString() - return information about the object public abstract double calCost(); //abstract method } Subclass: InPatient public class In Patient extends Patient { { private String roomType; // room type private int numDay; /umber of days warded //Methods: /ormal constructor //accessors; getRoom(), getNumDay() //toString() - return information about the object public double calCost() { method definition } } Subclass: Outpatient public class Outpatient extends Patient { { private String medicineType; /ormal or special private final double consultFee = 30.0; //Methods: /ormal constructor //accessors; getMediType() //toString() - return information about the object public double calCost() { method definition } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!