Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public class NumberSeven {
  2.  
  3.  
  4. public NumberSeven(int initialPosition) {
  5. this.initialPosition = initialPosition;
  6.  
  7. }
  8.  
  9. public static void main(String[] args) {
  10. NumberSeven seven = new NumberSeven(1);
  11. seven.toString();
  12. }
  13. //fields
  14. public int initialPosition;
  15. public int startingPoint = 1;
  16.  
  17. //constructor
  18.  
  19.  
  20. public void turn() {
  21. if (startingPoint == 1) {
  22. startingPoint = -1;
  23. }else {
  24. startingPoint = 1;
  25. }
  26. }
  27. public void move(int move) {
  28. initialPosition += move;
  29.  
  30. }
  31. //getter
  32. public int getPosition() {
  33. return initialPosition;
  34. }
  35. public String toString() {
  36. return initialPosition + "";
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement