-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBilling.java
More file actions
36 lines (30 loc) · 1.2 KB
/
Copy pathBilling.java
File metadata and controls
36 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package src;
public class Billing {
public static double[] computePaymentAmount(Patient patient, double amount) {
double[] payments = new double[2];
HealthInsurancePlan patientInsurancePlan = patient.getInsurancePlan();
Double amountPaidByInsuranceCompany = 0.0;
Double discount = 0.0;
if(patientInsurancePlan != null) {
amountPaidByInsuranceCompany = patientInsurancePlan.getCoverage() * amount;
discount = 0.0;
if (patientInsurancePlan instanceof PlatinumPlan) {
discount = 50.0;
} else if (patientInsurancePlan instanceof GoldPlan) {
discount = 40.0;
} else if (patientInsurancePlan instanceof SilverPlan) {
discount = 30.0;
} else if (patientInsurancePlan instanceof BronzePlan) {
discount = 25.0;
}
}
else{
amountPaidByInsuranceCompany = 0.0;
discount = 20.0;
}
Double amountPaidByPatient = amount - (amountPaidByInsuranceCompany + discount);
payments[0]= amountPaidByInsuranceCompany;
payments[1] = amountPaidByPatient;
return payments;
}
}