Advertisement
jaVer404

level05.lesson12.home03

Apr 5th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.68 KB | None | 0 0
  1. package com.javarush.test.level05.lesson12.home03;
  2.  
  3. /* Создай классы Dog, Cat, Mouse
  4. Создай классы Dog, Cat, Mouse. Добавь по три поля в каждый класс, на твой выбор. Создай объекты для героев мультика
  5. Том и Джерри. Так много, как только вспомнишь.
  6. Пример:
  7. Mouse jerryMouse = new Mouse(“Jerry”, 12 , 5), где 12 - высота в см, 5 - длина хвоста в см.
  8. */
  9.  
  10. public class Solution
  11. {
  12.     public static void main(String[] args)
  13.     {
  14.         Mouse jerryMouse = new Mouse("Jerry", 12 , 5);
  15.  
  16.         //Напишите тут ваш код
  17.         Cat tomCat = new Cat("Tom", 54, 150);
  18.         Dog someDog = new Dog("BigDog", 100, 200);
  19.     }
  20.  
  21.     public static class Mouse
  22.     {
  23.         String name;
  24.         int height;
  25.         int tail;
  26.  
  27.         public Mouse(String name, int height, int tail)
  28.         {
  29.             this.name = name;
  30.             this.height = height;
  31.             this.tail = tail;
  32.         }
  33.     }
  34.  
  35.     //Напишите тут ваши классы
  36.  
  37.     public static class Cat
  38.     {
  39.         String name;
  40.         int height;
  41.         int tail;
  42.  
  43.         public Cat(String name, int height, int tail)
  44.         {
  45.             this.name = name;
  46.             this.height = height;
  47.             this.tail = tail;
  48.         }
  49.     }
  50.  
  51.     public static class Dog
  52.     {
  53.         String name;
  54.         int height;
  55.         int tail;
  56.  
  57.         public Dog (String name, int height, int tail)
  58.         {
  59.             this.name = name;
  60.             this.height = height;
  61.             this.tail = tail;
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement