Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Cat {
- private String name;
- private String color;
- private String breed;
- private double weight;
- private int age;
- private double feed;
- public Cat (String name, String color, String breed, double weight, int age){
- this.name = name;
- this.color = color;
- this.breed = breed;
- this.weight = weight;
- this.age = age;
- }
- public Cat(){
- }
- 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 getColor (){
- return color;
- }
- public void setColor(String color) {
- this.color = color;
- }
- public double getWeight() {
- return weight;
- }
- public void setWeight(double weight) {
- this.weight = weight;
- }
- public int getAge() {
- return age;
- }
- public void setAge(int age) {
- this.age = age;
- }
- public double getFeed() {
- return weight*0.8;
- }
- public void setFeed(double feed) {
- this.feed = feed;
- }
- public void printCharacteristics (){
- System.out.println("Імя " + name);
- System.out.println("Колір " + color);
- System.out.println("Порода " + breed);
- System.out.println("Вага " + weight + " кг");
- System.out.println("Вік " + age + " років");
- System.out.format("Потрібно корму на день %.1f кr", + getFeed());
- System.out.println();
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement