Question
Create and test a Patient and a Billing class: Define two classes, Patient and Billing , whose objects are records for a clinic. Derive Patient
Create and test a Patient and a Billing class:
Define two classes, Patient and Billing, whose objects are records for a clinic. Derive Patient from the class Person in the Source Code folder.
A Patient record / object has the patients name (defined in the class Person) and identification number (use the type String).
A Billing object will contain a Patient object and a Doctor object (from Practice Program 2 above).
Give your classes a reasonable complement of constructors and accessor methods, and an equals method as well.
First write a driver program to test all your methods, then write a test program that:
creates at least two patients,
creates at least two doctors, and
creates at least two Billing records, and then
displays the total income from the Billing records (the sum of the Doctor fees from all of the Billing records).
------------------------------------------------------------------------------------------------------
here is the Person.java file:
public class Person { private String name; public Person( ) { name = "No name yet"; // can also say this("No name yet"); // calls the other constructor } public Person(String initialName) { name = initialName; } public void setName(String newName) { name = newName; } public String getName( ) { return name; } public void writeOutput( ) { System.out.println("Name: " + name); } public boolean hasSameName(Person otherPerson) { return this.name.equalsIgnoreCase(otherPerson.name); } }
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