-
-
Save GlebGomenyuk/6e7db73c72dae737f7b309af723d79cf to your computer and use it in GitHub Desktop.
HW1_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com; | |
public class Cat { | |
private String name; | |
private String breed; | |
private String sex; | |
private int height; | |
private int age; | |
private boolean wantsEats; | |
private boolean sleap; | |
private boolean walk; | |
private boolean play; | |
public Cat(String name, String breed, String sex, int height, int age, boolean wantsEats, boolean sleap, | |
boolean walk, boolean play) { | |
super(); | |
this.name = name; | |
this.breed = breed; | |
this.sex = sex; | |
this.height = height; | |
this.age = age; | |
this.wantsEats = wantsEats; | |
this.sleap = sleap; | |
this.walk = walk; | |
this.play = play; | |
} | |
public Cat() { | |
super(); | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public String getBreed() { | |
return breed; | |
} | |
public void setBreed(String breed) { | |
this.breed = breed; | |
} | |
public String getSex() { | |
return sex; | |
} | |
public void setSex(String sex) { | |
this.sex = sex; | |
} | |
public int getHeight() { | |
return height; | |
} | |
public void setHeight(int height) { | |
this.height = height; | |
} | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int age) { | |
this.age = age; | |
} | |
public boolean isWantsEats() { | |
return wantsEats; | |
} | |
public void setWantsEats(boolean wantsEats) { | |
this.wantsEats = wantsEats; | |
} | |
public boolean isSleap() { | |
return sleap; | |
} | |
public void setSleap(boolean sleap) { | |
this.sleap = sleap; | |
} | |
public boolean isWalk() { | |
return walk; | |
} | |
public void setWalk(boolean walk) { | |
this.walk = walk; | |
} | |
public boolean isPlay() { | |
return play; | |
} | |
public void setPlay(boolean play) { | |
this.play = play; | |
} | |
public String toString() { | |
return "Cat [name=" + name + ", breed=" + breed + ", sex=" + sex + ", height=" + height + ", age=" + age | |
+ ", wantsEats=" + wantsEats + ", sleap=" + sleap + ", walk=" + walk + ", play=" + play + "]"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com; | |
public class Main { | |
public static void main(String[] args) { | |
Cat myrzik = new Cat(); | |
myrzik.setName("Myrzik"); | |
myrzik.setBreed("Siam"); | |
myrzik.setSex("Male"); | |
myrzik.setHeight(12); | |
myrzik.setAge(8); | |
myrzik.setSleap(true); | |
System.out.println(myrzik); | |
Cat shtem = new Cat(); | |
shtem.setName("Shtem"); | |
shtem.setBreed("Britan"); | |
shtem.setSex("Male"); | |
shtem.setHeight(8); | |
shtem.setAge(3); | |
shtem.setWantsEats(true); | |
System.out.println(shtem); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment