0% found this document useful (0 votes)
595 views2 pages

SALVADOR - 05 Hands On Activity 1 ARG

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.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
595 views2 pages

SALVADOR - 05 Hands On Activity 1 ARG

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.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy