Advertisement
_MuradPro_

Baby

Jun 14th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.13 KB | None | 0 0
  1. package MuradHomeWork;
  2. public class Baby {
  3. String id;
  4. String gender;
  5. int hight;
  6. double weight;
  7.  
  8.    public Baby(String id, String gender, int hight, double weight)
  9.    {
  10.     this.id = id;
  11.     this.gender = gender;
  12.     this.hight = hight;
  13.     this.weight = weight;
  14.    }
  15.    
  16.    public Baby(String id, int hight, double weight)
  17.    {
  18.     this.id = id;
  19.     this.gender = "F";
  20.     this.hight = hight;
  21.     this.weight = weight;
  22.    }
  23.  
  24. public String getId() {
  25.     return id;
  26. }
  27.  
  28. public void setId(String id) {
  29.     this.id = id;
  30. }
  31.  
  32. public String getGender() {
  33.     return gender;
  34. }
  35.  
  36. public void setGender(String gender) {
  37.     this.gender = gender;
  38. }
  39.  
  40. public int getHight() {
  41.     return hight;
  42. }
  43.  
  44. public void setHight(int hight) {
  45.     this.hight = hight;
  46. }
  47.  
  48. public double getWeight() {
  49.     return weight;
  50. }
  51.  
  52. public void setWeight(double weight) {
  53.     this.weight = weight;
  54. }
  55.  
  56. public void updateWeight(double w) {
  57.     this.weight = weight + w;
  58. }
  59.  
  60. public void addHeight(int h) {
  61.     this.hight = hight + h;
  62. }
  63.  
  64. public boolean isSame(Baby other) {
  65.     if(this.hight == other.getHight() && this.weight == other.getWeight())
  66.         return true;
  67.     else
  68.         return false;
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement