1. Develop a simple program that stores a patient's blood details. Create two (2) classes named...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Develop a simple program that stores a patient's blood details. Create two (2) classes named BloodData (no class modifier) and RunBlood Data (public). 2. For the BloodData class: declare two (2) static String fields named blood Type for accepting O, A, B, and AB) and rhFactor (stands for Rhesus factor, an inherited protein found on the surface of red blood cells) for accepting + and - 3. For the default constructor (public) of the Blood Data class, set blood Type to "O" and rhFactor to '+'. 4. Create an overloaded constructor (public) with two (2) String parameters: bt and rh. In this constructor, blood Type should store bt while rhFactor should store rh. 5. Create a public method named display. This method will be used to display the values of blood Type and rhFactor. 6. In the RunBlood Data class, import the Scanner class for the user input. 7. In the main method, add statements to ask the user to input the blood type and the Rhesus factor (+ or -). Instantiate a Blood Data object name with arguments based on the user input. For example, BloodData bd = new BloodData(input1, input2); where input1 and input2 are String variables that stored what the user entered. If the user does not input anything, instantiate a BloodData object without an argument. 8. Print the confirmation message by invoking the display method through the object you created. For example, bd.display(); Note: Keep a copy of your code. It will be revised on your next laboratory session. Sample Output: Enter blood type of patient: Enter the Rhesus factor (+ or -): O+ is added to the blood bank. Enter blood type of patient: B. Enter the Rhesus factor (+ or -): - B is added to the blood bank. Explanation: In the first run, the user did not enter both values. Hence, the values stored in the default constructor are displayed. 1. Develop a simple program that stores a patient's blood details. Create two (2) classes named BloodData (no class modifier) and RunBlood Data (public). 2. For the BloodData class: declare two (2) static String fields named blood Type for accepting O, A, B, and AB) and rhFactor (stands for Rhesus factor, an inherited protein found on the surface of red blood cells) for accepting + and - 3. For the default constructor (public) of the Blood Data class, set blood Type to "O" and rhFactor to '+'. 4. Create an overloaded constructor (public) with two (2) String parameters: bt and rh. In this constructor, blood Type should store bt while rhFactor should store rh. 5. Create a public method named display. This method will be used to display the values of blood Type and rhFactor. 6. In the RunBlood Data class, import the Scanner class for the user input. 7. In the main method, add statements to ask the user to input the blood type and the Rhesus factor (+ or -). Instantiate a Blood Data object name with arguments based on the user input. For example, BloodData bd = new BloodData(input1, input2); where input1 and input2 are String variables that stored what the user entered. If the user does not input anything, instantiate a BloodData object without an argument. 8. Print the confirmation message by invoking the display method through the object you created. For example, bd.display(); Note: Keep a copy of your code. It will be revised on your next laboratory session. Sample Output: Enter blood type of patient: Enter the Rhesus factor (+ or -): O+ is added to the blood bank. Enter blood type of patient: B. Enter the Rhesus factor (+ or -): - B is added to the blood bank. Explanation: In the first run, the user did not enter both values. Hence, the values stored in the default constructor are displayed.
Expert Answer:
Answer rating: 100% (QA)
Java public class RunBloodData public static void mainString args Scanner scanner new ScannerSystemin SystemoutprintEnter blood type of patient String ... View the full answer
Related Book For
Data Structures and Algorithms in Python
ISBN: 978-1118290279
1st edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
All else equal, a large sell off in the equity markets (decline in the S&P 500 and the Dow Jones Industrial Average) would be the most likely result from the reporting of a much higher than expected...
-
Describe the accounting procedures or journal entries required when bonds are retired before maturity. Why would a company choose to retire debt early?
-
Explain relationships between the Comprehensive Environmental Response, Compensation, and Liability Act (CERCLA) and the Superfund Amendment and Reauthorization Act (SARA) of 1986.
-
What is an LVDT? How does it work?
-
Cruise Industries purchased $10,800 of merchandise on February 1, 2014, subject to a trade discount of 10% and with credit terms of 3/15, n/60. It returned $2,500 (gross price before trade or cash...
-
Blossom Railroad Co. is about to issue $314,000 of 10-year bonds paying an 12% interest rate, with interest payable annually. The discount rate for such securities is 8%. Click here to view the...
-
A vertical cylinder, fitted with a frictionless leak-proof piston, contains 0-03 kg f dry-saturated steam. The upper face of the piston is exposed to the atmosphere; the weight of the piston is such...
-
Write the impact of employee issues on individual and organizational performance.
-
Please answer the questions in detail: 1. Explain Packet Switching. Why is it important? 2. Explain the TCP/IP Protocol. Assignment Instructions Please cite and reference all sources of information....
-
Tate's Bake Shop manufacturers and sells cookies. The Company has four main, but differently made, products - Chocolate Chip, Oatmeal Raisin, Double Chocolate, and Gluten Free. The Company currently...
-
State a utility function in general form for a consumer that includes health as one good and "all other goods" as the second good. In this derivation, consider that health is a good that is...
-
Define a causal-loop logic in relation to corporate objectives. Why is it important to distinguish between casual-loop and sequential logic in defining project objectives?
-
What do you believe to be the primary duties and responsibilities of a practicing pharmacist?
-
Quality Chicken grows and processes chickens. Each chicken is disassembled into five main parts. Information pertaining to production in July 2012 is: Joint cost of production in July 2012 was $50. A...
-
Use a scatter plot to display the data shown in the table at the left. The data represent the numbers of coaching hours and the hourly fees (in dollars) of 12 cricket coaches. Organize the data using...
-
Use a scatter plot to display the data shown in the table at the left. The data represent the numbers of coaching hours and the hourly fees (in dollars) of 12 cricket coaches. Organize the data using...
-
Tourism Use a time series chart to display the data shown in the table. The data represent the percentages of Egypts gross domestic product (GDP) that come from the travel and tourism sector....
Study smarter with the SolutionInn App