MkArs

Untitled

Nov 5th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package pets;
  2.  
  3. public class Fish extends Pet {
  4.  
  5. int currentX=0;
  6. int currentDepth=0;
  7.  
  8. public int dive(int howDeep){
  9. currentDepth=currentDepth + howDeep;
  10. System.out.println("Ныряю на глубину " + howDeep + " футов");
  11. System.out.println("Я на глубине " + currentDepth + " футов ниже уровня моря");
  12. return currentDepth;
  13. }
  14.  
  15. public int dive(int howDeep, int movementX){
  16. currentDepth=currentDepth + howDeep;
  17. currentX=currentX + movementX;
  18. System.out.println("Ныряю на глубину " + howDeep + " футов");
  19. System.out.println("Я на глубине " + currentDepth + " футов ниже уровня моря");
  20. System.out.println("Я сдвинyлся на " + currentX + " фyтов (ось x)");
  21. return currentX;
  22. }
  23. public String say(String something){
  24. return ("Ты чё не знаешь, что рыбы не разговаривают?");
  25. }
  26. }
Add Comment
Please, Sign In to add comment