Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class bugTester
- {
- public static void main()
- {
- bug b1 = new bug();
- System.out.println("The inital position of the bug is >>> ");
- System.out.println("Direction " + b1.getDirection());
- System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
- System.out.println("Row " + b1.getRow());
- System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
- System.out.println("Column " + b1.getColumn());
- System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
- b1.display();
- boolean retry = true;
- while(retry == true)
- {
- System.out.println("Please enter a Direction you would like to go(1-N 2-S 3-E 4 - W)");
- Scanner in = new Scanner(System.in);
- b1.turn(in.nextInt());
- System.out.println("Please enter an ammount of units you would like to move");
- b1.move(in.nextInt());
- b1.display();
- System.out.println("Would you like to move the bug again y-yes n-no >>>>>");
- String s = in.nextLine();
- if(s.equals("n"))
- {
- System.out.println("Thank you for using the bug Program tester");
- retry = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement