Question: Java problem. Constructors, methods, objects AT&T LTE 16:43 * 55% Program3.pdf Concepts: Scanner, loops, classes, objects, cient classes Point value: 100 point Note: Name your

Java problem. Constructors, methods, objects  Java problem. Constructors, methods, objects AT&T LTE 16:43 * 55% Program3.pdf
Concepts: Scanner, loops, classes, objects, cient classes Point value: 100 point Note:

AT&T LTE 16:43 * 55% Program3.pdf Concepts: Scanner, loops, classes, objects, cient classes Point value: 100 point Note: Name your classes XXX Bug and XxX BugSimulation (5 points) Assignment The class Bug simulates a bug moving along a horizontal line The horizontal ine is organized like the X axis of the coordinate plane with the center at position 0, extending infinitely to the left and right of the center. ABug has position and direction. The Bug's position is the location of the bug on the horizontal line. The Bug's direction is either left or right A Bug moves and turns. The move method simulates the bug moving one unit in the direction it is facing. The turn method simulates changing the bug's direction (from left to right or from right to left) The getPosition method returns the current position of the bug. The getDirection method retums the current direction of the bug. When a Bug object is first created, it is always facing to the right. Its pesition may or may not be provided. If it is not provided, the bug is positioned at "O The Bug class must allow for a Bug to be created at a specified position or to default to O A clent dass called, BugSimelation simulates a bug moving on the horizontal line. The program will - Ask the user for the Bug's initial position -Create a Bug object facing right at the position entered by the user Print a message that a Bug object has been created at that position with initia . Ask the user how many times the Bug should move Simulate the Bug moving that many times Ask the user how many times the Bug should turn Simulate the Bug turning that many times Print the Bug's position and direction . Ask the user how many times the Bug should move Simulate the Bug moving that many times Print the Bug's position and direction Enter the starting position of the bug Creating Bug at position 3 facing Right CPS 2231 How many times should the bug move? Bug moved Bug moved Bug is at position 8 facing Right How many times should the bup turn? Bug turned Bug tuned Bug turnerd E Open With Print

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!