Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algorithm Design And Applications

Authors: Michael T. Goodrich, Roberto Tamassia

1st Edition

1118335910, 978-1118335918

More Books

Students also viewed these Algorithms questions