Question: a. Generate a named BloodData that includes String fields that hold a blood type ( the four blood types are O, A, B, AB) and

a. Generate a named BloodData that includes String fields that hold a blood type ( the four blood types are O, A, B, AB) and an Rh factor ( the factors are + and -). Generate a default constructor that sets the fields to O and + and an overloaded constructor that requires values for both fields. Include get and set methods for each field. Save the file as BloodData.java

b. Generate an application named TestBloodData that declares two objects. Prompt the user for values for one, and use the default constructor values for the other. Display the details of both objects. Then change the values in the default object so it uses the user's values, and display the details for the object to confirm the changes are made correctly. Save the application as TestBloodData.java

c. Devise a class named Patient that include an ID number, age, and BloodData. Provide a default constructor that sets the ID number to 0, the age to 0 and the BloodData values to the default BloodData values (O and +). Generate an overloaded constructor that provides values for each field. Save the file as Patient.java

d. Generate an application that declares three Patient objects. Use all default values for one Patient object, prompt the user for values for the second Patient object, and for the third object, prompt the user for Patient data but use default values for that Patient's BloodData. Save file as TestPatient.java

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 Algorithms Questions!