Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level05.lesson12.home03;
- /* Создай классы Dog, Cat, Mouse
- Создай классы Dog, Cat, Mouse. Добавь по три поля в каждый класс, на твой выбор. Создай объекты для героев мультика
- Том и Джерри. Так много, как только вспомнишь.
- Пример:
- Mouse jerryMouse = new Mouse(“Jerry”, 12 , 5), где 12 - высота в см, 5 - длина хвоста в см.
- */
- public class Solution
- {
- public static void main(String[] args)
- {
- Mouse jerryMouse = new Mouse("Jerry", 12 , 5);
- //Напишите тут ваш код
- Cat tomCat = new Cat("Tom", 54, 150);
- Dog someDog = new Dog("BigDog", 100, 200);
- }
- public static class Mouse
- {
- String name;
- int height;
- int tail;
- public Mouse(String name, int height, int tail)
- {
- this.name = name;
- this.height = height;
- this.tail = tail;
- }
- }
- //Напишите тут ваши классы
- public static class Cat
- {
- String name;
- int height;
- int tail;
- public Cat(String name, int height, int tail)
- {
- this.name = name;
- this.height = height;
- this.tail = tail;
- }
- }
- public static class Dog
- {
- String name;
- int height;
- int tail;
- public Dog (String name, int height, int tail)
- {
- this.name = name;
- this.height = height;
- this.tail = tail;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement