Question
Java eclipse / zybook : note: Needs super class / subclass inheritance Define a class Person that holds person's name and appropriate constructors, get/set methods,
Java eclipse / zybook :
note: Needs super class / subclass inheritance
Define a class Person that holds person's name and appropriate constructors, get/set methods, display and hasSameName methods. hasSameName method will return true if two objects of data type Person have the same name. Then define a class named Doctor whose objects are records for a clinic's doctors. Drive this class from the class Person. A Doctor record has doctor's name, a specialty, and office visit fee. Give your class a reasonable complement of constructors and get/set methods, and an equals method as well. The equals method returns true if two doctor records are the same. Name this class BillingRecordDemo. Drive Patient form the class Person. A patient record has the Patient's name, and an identification number. A Billing object will contain a Patient object and a Doctor object. Give your class a reasonable complement of constructors, get/set methods, display and an equals method.
Use the following BillingRecordDemo.java:
import java.util.Scanner;
public class BillingRecordDemo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Patient p1 = new Patient("John Brook", 110453);
Patient p2 = new Patient("Samantha Oliver", 921123);
Patient p3 = new Patient("Ryan Badr", 118922);
Patient p4 = new Patient("Mona Sharma", 211156);
Doctor d1 = new Doctor("Garry Allen", "Internal Medicine", 245.90);
Doctor d2 = new Doctor("Sarah Elder", "Surgery", 425.75);
Billing b1 = new Billing(d1 , p1);
Billing b2 = new Billing(d1 , p2);
d1.display();
Billing b3 = new Billing(d2 , p3);
Billing b4 = new Billing(d2 , p4);
Billing b5 = new Billing(d2 , p1);
d2.display();
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started