binibiningtinamoran

BloodData.java

May 2nd, 2020
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public class BloodData {
  2.  
  3.     private String type;
  4.     private String rH;
  5.  
  6.     // Overloaded constructor
  7.     // this consturctor calls the parametrized constructor
  8.     public BloodData() {
  9.         this("O", "+");
  10.     }
  11.  
  12.     public BloodData(String type, String rH) {
  13.         this.type = type;
  14.         this.rH = rH;
  15.     }
  16.  
  17.     public String getType() {
  18.         return type; // or return this.type;
  19.     }
  20.  
  21.     public String getRH() {
  22.         return rH; // or return this.rH;
  23.     }
  24.  
  25.     public void setType(String type) {
  26.         this.type = type;
  27.     }
  28.  
  29.     public void setrH(String rH) {
  30.         this.rH = rH;
  31.     }
  32.  
  33.     @Override
  34.     public String toString() {
  35.         return "Your blood type is " + type + ", and your RH is " + rH + ".";
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment