This document appears to be instructions for a hands-on activity on building a blood bank program in Java. It includes code for a BloodData class that stores blood type and Rh factor attributes, with getters and setters. The main method then prompts the user to input a blood type and Rh factor, creates a new BloodData object with those values, and prints a message confirming the addition to the blood bank.
This document appears to be instructions for a hands-on activity on building a blood bank program in Java. It includes code for a BloodData class that stores blood type and Rh factor attributes, with getters and setters. The main method then prompts the user to input a blood type and Rh factor, creates a new BloodData object with those values, and prints a message confirming the addition to the blood bank.
This document appears to be instructions for a hands-on activity on building a blood bank program in Java. It includes code for a BloodData class that stores blood type and Rh factor attributes, with getters and setters. The main method then prompts the user to input a blood type and Rh factor, creates a new BloodData object with those values, and prints a message confirming the addition to the blood bank.
return bloodType; } public String getRhFactor(){ return rhFactor; } public void setBloodType(String bloodType){ this.bloodType = bloodType; } public void setRhFactor(String rhFactor){ this.rhFactor = rhFactor; }
public void BloodData(String bt, String rh){
this.bloodType = bt; this.rhFactor = rh; System.out.println(bt+rh +" is added to the blood bank."); } }
public class RunBloodData05 {
public static void main(String[] args){ BloodData bds = new BloodData(); bds.setBloodType("O"); bds.setRhFactor("+"); System.out.println("Enter blood type of patient:"); System.out.println("Enter the Rhesus factor (+ or -):"); System.out.println(bds.getBloodType()+bds.getRhFactor()+" is added to the blood bank."); System.out.println("");
BloodData bd = new BloodData();
Scanner input = new Scanner(System.in); System.out.print("Enter blood type of patient: "); String bt = input.nextLine(); System.out.print("Enter the Rhesus factor (+ or -):"); String rh = input.nextLine(); bd.BloodData(bt, rh); } }