Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Write two java files, b.java and bTester.java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started