Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MuradHomeWork;
- public class Baby {
- String id;
- String gender;
- int hight;
- double weight;
- public Baby(String id, String gender, int hight, double weight)
- {
- this.id = id;
- this.gender = gender;
- this.hight = hight;
- this.weight = weight;
- }
- public Baby(String id, int hight, double weight)
- {
- this.id = id;
- this.gender = "F";
- this.hight = hight;
- this.weight = weight;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getGender() {
- return gender;
- }
- public void setGender(String gender) {
- this.gender = gender;
- }
- public int getHight() {
- return hight;
- }
- public void setHight(int hight) {
- this.hight = hight;
- }
- public double getWeight() {
- return weight;
- }
- public void setWeight(double weight) {
- this.weight = weight;
- }
- public void updateWeight(double w) {
- this.weight = weight + w;
- }
- public void addHeight(int h) {
- this.hight = hight + h;
- }
- public boolean isSame(Baby other) {
- if(this.hight == other.getHight() && this.weight == other.getWeight())
- return true;
- else
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement