3
Hospital -name:String -dailyCharge:Double -patientArray[]:Patient +calculateCharge(int days):Do Private -specialty:String Public Date -month:int -day:int -year:int Patient -name:String -dateAdmited:Date -dateReleased:Date

Hospital -name:String -dailyCharge:Double -patientArray[]:Patient +calculateCharge(int days):Double Private -specialty:String Public Date -month:int -day:int

Embed Size (px)

Citation preview

Page 1: Hospital -name:String -dailyCharge:Double -patientArray[]:Patient +calculateCharge(int days):Double Private -specialty:String Public Date -month:int -day:int

Hospital-name:String-dailyCharge:Double-patientArray[]:Patient

+calculateCharge(int days):Double

Private-specialty:String

Public

Date-month:int-day:int-year:int

Patient-name:String-dateAdmited:Date-dateReleased:Date

Page 2: Hospital -name:String -dailyCharge:Double -patientArray[]:Patient +calculateCharge(int days):Double Private -specialty:String Public Date -month:int -day:int

Write the system of classes represented in the UML. Be sure to adhere to ourJava coding standards. There is an additional method in the Hospital class andits children: calculateCharge. This method determines how many days the patientwas in the hospital and calculates the charge to the patient. If the patient staysin a private hospital, there is an additional fee of $50. If the patient stays in apublic hospital, there is an 8% tax. The Hospital class has an array of patients tostore the patients currently in the hospital.

The hospital data is stored in a two-dimensional array , hospitalData, with the following data:

Private St. John $125.00Private St. Jude $157.50Public Arlington Memorial $137.75Public Baylor $176.80

Page 3: Hospital -name:String -dailyCharge:Double -patientArray[]:Patient +calculateCharge(int days):Double Private -specialty:String Public Date -month:int -day:int

The patient data is stored in a two-dimensional array , patientData, with the following data:

Baylor Jones 3/3/2010 3/7/2010St. Jude Smith 1/1/2010 1/25/2010St. Jude Willis 4/1/2010 4/2/2010St. John Gates 8/7/2010 8/13/2010Baylor Kramer 9/26/2010 9/30/2010Arlington Memorial Davis 2/20/2010 2/27/2010Arlington Memorial Cord 5/10/2010 5/13/2010St. John Martin 6/5/2010 6/12/2010

You will walk through the hospital data array and the patient data array topopulate andarray of Hospitals, hospitalArray. For example, the first hospital and itspatients would be in the first slot of hospitalArray.

hospitalArray[0] would have in it St. John with a daily charge of $125.00 anda patientArray with two patients: Gates and Martin.

Once the hospitalArray has been populated, your program will walk through thearray and calculate the charge for each patient. You will print the patient nameand the patient’s total charge at the command prompt. Be sure to format the money.