SALVADOR - 05 Hands On Activity 1 ARG

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Salvador, Kaycee Hands-On Activity

IT301A Blood Bank (Part 2)

Code

import java.util.Scanner;
class BloodData {
private String bloodType;
private String rhFactor;

public String getBloodType(){


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);
}
}

You might also like