Question: JAVA ECLIPSE CODE topic: exceptions Given that you will need 5 classes: person, patient, doctor, billing, and main, Given the following codes: A possible output
JAVA ECLIPSE CODE
topic: exceptions
Given that you will need 5 classes: person, patient, doctor, billing, and main,
Given the following codes:




A possible output may look like the following:
Enter number of doctors in the facility: 2 Enter number of patients in the facility: 5 ----------------------------- given that you need Create Doctor Array: ----------------------------- Doctor 1 Enter doctor's name: Garry Allen Enter Specialty: Family Medicine Enter office visit fee: 180.65 Doctor 2 Enter doctor's name: Sarah Adler Enter Specialty: Cardiology Enter office visit fee: 540.98 ----------------------------- Create Patient Array: ----------------------------- Patient 0 Enter Patient's name: Bruce Ammar Enter Patient ID: 1234 Patient 1 Enter Patient's name: Mike Anderson Enter Patient ID: 2345 Patient 2 Enter Patient's name: Jenna Baily Enter Patient ID: 5678 Patient 3 Enter Patient's name: Mark Kapur Enter Patient ID: 6789 Patient 4 Enter Patient's name: Lilian Snyder Enter Patient ID: 7890 Enter Patient index: 0 Enter Doctor index: 0 Do you want to set another appointment? (y)y Enter Patient index: 0 Enter Doctor index: 1 Do you want to set another appointment? (y)y Enter Patient index: 3 Enter Doctor index: 0 Do you want to set another appointment? (y)y Enter Patient index: 4 Enter Doctor index: 1 Do you want to set another appointment? (y)y Enter Patient index: 2 Enter Doctor index: 0 Do you want to set another appointment? (y)y Enter Patient index: 1 Enter Doctor index: 1 Do you want to set another appointment? (y)n Name Garry Allen Specialty Family Medicine Office Visit Fee $180.65 Total Income $541.95 ------------------------------------ Name Sarah Adler Specialty Cardiology Office Visit Fee $540.98 Total Income $1622.94 ------------------------------------
*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. public class Doctor extends Person //String name: from super class protected String specialty; protected double visitFee; protected double income; public Doctor(String name, String specialty, double visitFee) super(name); this.specialtyspecialty; this.visitFee visitFee; this.income0; public String getSpecialty) return specialt y; public double getVisitFee() { return visitFee; public void display) { super.display); System.out . printf("%-20s System.out.printf("%-20s System.out.printf("%-20s %s ", "Specialty", specialty); 5%.2f ", "Office Visit Fee", visitFee); ?.2f ", "Total Income", income); public void oneLineDisplay) System.out . printf("%-20s %-20s $%2f ", name, specialty, visitFee); public boolean equals (Doctor secondDoctor) { boolean nameStatus name.equalsIgnoreCase (secondDoctor.getName) boolean specialtyStatus specialty.equalsIgnoreCase(secondDoctor.getSpecialty)); boolean visitFeeStatus - visitFeesecondDoctor.getVisitFee(); if (nameStatus && specialtyStatus && visitFeeStatus) return true; else return false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
