Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedplease 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago