Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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();

}

}

Sample Run:

Name Garry Allen

Specialty Internal Medicine

Office Visit Fee $245.90

Total Income $491.80

------------------------------------

Name Sarah Elder

Specialty Surgery

Office Visit Fee $425.75

Total Income $1277.25

------------------------------------

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

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions

Question

=+6. What communication already has been done about this situation?

Answered: 1 week ago