In: Computer Science
1. A doctor’s office has at least 2 patients but can have up to 30 patients. All patients have names, number of doctor’s visits, and total copayments for the year so far. After each visit, you need to be able to update each patient’s number of doctor’s visits and total copayments for the year.
a. Create the UML for the class diagram for patients.
b. Create the Java implementation for patients.
Patients.uml
patients.java
/**
* This is the implementation of patients entity
*
* @author xyz
*
*/
public class Patient {
private String name;
private int numberOfVisits;
private double totalCoPayment;
public Patient() {
super();
}
/**
* Increment patient's visit count on each visit by
one
*/
public void incrementVisitCount() {
this.numberOfVisits++;
}
/**
* Update total co-payment amount paid by patient
*
* @param amount
*/
public void updateTotalCopayment(double amount)
{
this.totalCoPayment +=
amount;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumberOfVisits() {
return numberOfVisits;
}
public void setNumberOfVisits(int numberOfVisits)
{
this.numberOfVisits =
numberOfVisits;
}
public double getTotalCoPayment() {
return totalCoPayment;
}
public void setTotalCoPayment(double
totalCoPayment) {
this.totalCoPayment =
totalCoPayment;
}
}
Please let me know if you have any question on this?