Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please I really need help Question 1- Class Robot & Driver to test it Part a) Class Robot A robot has a name and moves
please I really need help
Question 1- Class Robot & Driver to test it Part a) Class Robot A robot has a name and moves in a 2-dimensional plane (square grid) in a specified direction. It starts at location (0,0) facing East and moves a randomly generated number of steps each turn until it reaches the top right corner of the grid, whose coordinates will be N x N, where N is the size of the square grid. The (x,y) coordinates are to be modified as follows (see figure 1): If robot is facing E, it will move right, so the x coordinate is increased. f the robot is facing W, it will move left, so the x coordinate is decreased If the robot is facing N, it will move up, so the y coordinate is increased. f the robot is facing S, it wi move down, so the y coordinate is decreased 5 y-axis (0, 4) The robot cannot walk off the grid. So when it reaches the edge of the grid during any of its turns it needs to change directions and complete the remaining number of steps in the new direction X-axis Figure 1- Grid robot must move in ifa 5x5 grid Implement the class Robot based on the following specification. The class has four instance variables: o name that holds the name of the robot (which can be more than one word long) x and y which are the integer coordinates of the robot's location (between 0 and N, where n is the size of the grid)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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