BloodData Code

TestPatient.java

/*
 * Mark Hesser
 * HesserCAN 
 * [email protected]
 * www.hessercan.com
 */
package blooddata;
 
/**
 *
 * @author mark
 */
public class TestPatient {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Patient fred = new Patient();
        Patient wilma = new Patient(2, 40, "A", "-");
 
        System.out.println(String.format("ID: %d, Age: %d, Blood Type: %s, Rh Factor: %s", 
                fred.getIDnum(), fred.getAge(), fred.getBloodType(), fred.getRhFactor()));
        System.out.println(String.format("ID: %d, Age: %d, Blood Type: %s, Rh Factor: %s", 
                wilma.getIDnum(), wilma.getAge(), wilma.getBloodType(), wilma.getRhFactor()));
    }
 
}

Patient.java

/*
 * Mark Hesser
 * HesserCAN 
 * [email protected]
 * www.hessercan.com
 */
package blooddata;
 
/**
 *
 * @author mark
 */
public class Patient {
    private int IDnum;
    private int Age;
    private String BloodType;
    private String RhFactor;
 
    public Patient(){
        IDnum = 0;
        Age = 1;
        BloodType = "O";
        RhFactor = "+";
    }
    public Patient(int id, int age, String type, String rh){
        this.IDnum = id;
        this.Age = age;
        this.BloodType = type;
        this.RhFactor = rh;
    }
    public int getIDnum(){
        return IDnum;
    }
    public int getAge(){
        return Age;
    }
    public String getBloodType(){
        return BloodType;
    }    
    public String getRhFactor(){
        return RhFactor;
    }
}