Question: Write two java files, b.java and bTester.java A method to move some number of units in one direction public void move (int num) Important: You

Write two java files, b.java and bTester.java
 Write two java files, b.java and bTester.java A method to move
some number of units in one direction public void move (int num)
Important: You should not let the bug move out of the grid

A method to move some number of units in one direction public void move (int num) Important: You should not let the bug move out of the grid if the bug hits the boundary Specifically If the current row value is 1, then the bug cannot move north further. then the bug cannot move east further. If the current row value is 5, then the bug cannot move south further If the current column value is 1, then the bug cannot move west further A method to display the current position and direction of the bug in the grid. public void printCurrentPositionO Hint. Basically you ean print out a 5 x 10 matrix of dots () exeopt for the bug's position. For the bug's poasition, you may print out a character of "NE-S-W" Lo indicate its current direction. Stage 2: In the second file BugTester.java, your need to test the methods you implement. In particular, you need to do the followings: 1. Create a Bug object, and initialize the object with your own choice; 2. Print out the bug's initial position; 3. Ask the user to enter the direction for the bug to turn, and the number of units for the bug to move. These information should be the inputs for the methods of turn and move; 4. Print out the bug's current position from the previous action 5. Ask the user to try it again

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!