jaVer404

level05.lesson05.task04

Apr 2nd, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. package com.javarush.test.level05.lesson05.task04;
  2.  
  3. /* Создать три объекта типа Cat
  4. В методе main создать три объекта типа Cat и заполнить их данными.
  5. Использовать класс Cat из первой задачи. Класс Cat создавать не надо.
  6. */
  7.  
  8. public class Solution {
  9.     public static void main(String[] args) {
  10.         //add your code here
  11.         Cat cat1 = new Cat("Roma", 30,85, 100);
  12.         Cat cat2 = new Cat("Andriy", 31, 90, 99);
  13.         Cat cat3 = new Cat("Kum1", 30, 75, 98);
  14.     }
  15.  
  16.     public static class Cat {
  17.  
  18.         public static int count = 0;
  19.         private String name;
  20.         private int age;
  21.         private int weight;
  22.         private int strength;
  23.  
  24.         public Cat(String name, int age, int weight, int strength) {
  25.             count++;
  26.  
  27.             this.name = name;
  28.             this.age = age;
  29.             this.weight = weight;
  30.             this.strength = strength;
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment