Question: Need help with the following assignment in JAVA. I will provide my Patient i have but i need help changing into enum classes as shown.

Need help with the following assignment in JAVA. I will provide my Patient i have but i need help changing into enum classes as shown. PLEASE USE THE MAIN CLASS SHOWN ON THE PICTURE TO TEST THE ASSIGNMENT.

my class I need help editing

class Patient {

private int id;

private int age;

BloodData bd;

public Patient() {

id = 0;

age = 0;

bd = new BloodData("O", '+');

}

public Patient(int aId, int aAge, char aRhFactor, String aBlood_type) {

super();

id = aId;

age = aAge;

bd = new BloodData(aBlood_type, aRhFactor);

}

public int getId() {

return id;

}

public void setId(int aId) {

id = aId;

}

public int getAge() {

return age;

}

public void setAge(int aAge) {

age = aAge;

}

public BloodData getBd() {

return bd;

}

public void setBd(BloodData aBd) {

bd = aBd;

}

class BloodData {

String blood_type;

char rhFactor;

public BloodData(String aBlood_type, char aRhFactor) {

super();

blood_type = aBlood_type;

rhFactor = aRhFactor;

}

public BloodData(String aBlood_type) {

super();

blood_type = aBlood_type;

rhFactor = '+';

}

public BloodData(char aRhFactor) {

super();

blood_type = "O";

rhFactor = aRhFactor;

}

}

// displays blood data

public void displayBlood() {

System.out.println("Blood type : " + bd.blood_type + bd.rhFactor);

}

}Need help with the following assignment in JAVA. I will provide my

Enumeration Lab 07 - Patient Info. Part 2 Refactor your BloodData Class to utilize enums for blood_type (O, A, B, or AB) and RhFactor(+, -), instead of Strings and chars. You may have to make additional changes elsewhere in your patient class. Note:+'and -'are illegal identifiers. You must use an enum constructor to hold char data. Simple Main Your main must only contain the following lines of code and execute with the expected output. Patient Timmy-new Patient); System.out,printin("Patient ID: "+ Timmy.getiDO+ Timmy.displayBlood0 Patient Spike = new Patient(1337, 19. RhFactor.NEGATIVE. BloodType.AB) nPatient Age:"+ Timmy.getAge0): System.out.printin("Patient ID:"+ Spike.getiDO + nPatient Age: "+ Spike.getAge)); Spike.displayBlood) Expected Output: Patient ID: 0 Patient Age: 0 Blood Type: O+ Patient ID: 1337 Patient Age: 19 Blood Type: AB

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!