Question: java QUESTION 4 (25 points): Write a class named Robot that takes a point (x,y) to represent a robot's initial location (in centimeters) as well

 java QUESTION 4 (25 points): Write a class named Robot that

java

QUESTION 4 (25 points): Write a class named Robot that takes a point (x,y) to represent a robot's initial location (in centimeters) as well as its orientation (an angle called theta which is a value between 0 and 360 degrees). You can either set these values in your code directly or ask the user for them (using the Scanner class). They could all be integers. Assume the robot moves forward d centimeters. Compute and display the final location of the robot after it moves. The new location is computed as point (x + d cos(theta), y + d sin(theta)). Remember that the sine and cosine functions in JAVA use radians, not degrees. To convert degrees to radians, you need to multiply the degrees by Math.PI/180 and if you need to convert from radians to degrees you can multiply the radians by 180/Math.PI. Write a class called Robottest to test your code...remembering that 0 degrees is to the right (as shown below in red), 90 degrees is up, 180 degrees is left and the angle theta shown below is around 135 degrees. y-axis (cm) d (X.) X-axis (cm)

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!