Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pets;
- public class Fish extends Pet {
- int currentX=0;
- int currentDepth=0;
- public int dive(int howDeep){
- currentDepth=currentDepth + howDeep;
- System.out.println("Ныряю на глубину " + howDeep + " футов");
- System.out.println("Я на глубине " + currentDepth + " футов ниже уровня моря");
- return currentDepth;
- }
- public int dive(int howDeep, int movementX){
- currentDepth=currentDepth + howDeep;
- currentX=currentX + movementX;
- System.out.println("Ныряю на глубину " + howDeep + " футов");
- System.out.println("Я на глубине " + currentDepth + " футов ниже уровня моря");
- System.out.println("Я сдвинyлся на " + currentX + " фyтов (ось x)");
- return currentX;
- }
- public String say(String something){
- return ("Ты чё не знаешь, что рыбы не разговаривают?");
- }
- }
Add Comment
Please, Sign In to add comment