subject

Ineed writing a prgram for a crab the current code is posted below the question.1. double-click on the crab class in the greenfoot class diagram to open the class in an editor window. write the body of the turnleft() method in the crab class. this method causes a crab to turn/rotate 90 degrees to its left (i. e., with respect to its current orientation).be sure to test the turnleft() method before proceeding to the next step.2.write the body of the backup() method in the crab class. this method causes a crab to "back up" (move backwards) the indicated distance with respect to its current orientation. the crab’s orientation must not change. for example, the method call backup(50) would cause the crab to move backwards 50 units. be sure to test the backup() method before proceeding to the next step.3.write the body of the act() method in the crab class. this method defines the following behavior for a crab: first, the crab moves forward distance 5. then, the crab checks to see if it is at an edge of the world. if it is, the crab moves backwards 50 units using the backup() method and then turns to its left using the turnleft()method. be sure to test the act() method before proceeding to the next step.4. challenge: the crab is walking straight into the gull, which is probably not a good idea (links to an external site.)links to an external site.. let’s the crab out by changing the act() method to ensure that the crab walks below the gull when it makes the trip across the top of the screen. specifically, you need implement the following behavior in the act() method: first, the crab moves forward distance 5. then, the crab checks to see if it is at an edge of the world. if it is, the crab then checks to see if it’s the top edge. if it is the top edge, the crab moves backwards 150 units using the backup()method. no matter which edge it is at, the crab then moves backwards 50 units using the backup() method and then turns to its left using the turnleft() method. to do this, you will have to search through the documentation of the actor class to find a method that will allow you to detect when the crab is at the top edge of the world. once you find the method you need to use, the hints below should you put this all together. you will need to add another if statement inside the one you already have. you can ask if two int values are equal by using the == operator. (this is two equal signs with no space in between.) here are some examples: 5 == 5 evalutes to true3 == 5 evaluates to falselet’s say there is a method m() that returns an int value. then you can check if this method returns a particular value like this: if (m() == 5).crab code below: import greenfoot.*; /*** this class defines a crab. crabs live on the beach.*/public class crab extends actor{public void act(){} /** turns the crab to face left from its current perspective. */public void turnleft() { } /** moves the crab backwards the given distance. */public void backup(int distance) { }}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 09:50
Suppose you are an ad-serving company and you maintain a log of cookie data for ads you serve to the web pages for a particular vendor (say amazon). a. how can you use this data to determine which are the best ads? b. how can you use this data to determine which are the best ad formats? c. how could you records of past ads and ad clicks to determine which ads to send to a given ip address? d. how could you use this data to determine how well the technique you used in your answer to part c was working? e. how could you use this data to determine that a given ip address is used by more than one person? f. how does having this data give you a competitive advantage vis-Ă -vis other ad-serving companies?
Answers: 2
question
Computers and Technology, 24.06.2019 12:40
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
question
Computers and Technology, 25.06.2019 00:00
What function key is used to enable the spelling and grammar function
Answers: 1
question
Computers and Technology, 25.06.2019 01:00
What phrase indicates someone has knowledge and understanding of computer,internet,mobile devices and related technologies?
Answers: 1
You know the right answer?
Ineed writing a prgram for a crab the current code is posted below the question.1. double-click on...
Questions
question
Social Studies, 20.11.2019 00:31
question
Mathematics, 20.11.2019 00:31