Answered step by step
Verified Expert Solution
Question
1 Approved Answer
we need it java 1 of 2 ID: The Robot In this exercise, we want to develop a program that manages the movement of a
we need it java
1 of 2 ID: The Robot In this exercise, we want to develop a program that manages the movement of a simple robot. Such a robot occupies a certain position (X, Y) (X and Y typed int) and has an orientation among (North, East, South West). The value of the orientation can take a constant value between 1 and 4: 1: for North 2: for East 3: for South 4: for West This robot is initialized by the user at a given position and orientation. He can turn only to the right and can go one step forward 1. Create the class Robot which contains: a) Three instance variable X Yand orientation typed int. b) The method movingForwardO which moves the robot one step c) The method turnRightO which turns the robot to the right. 2. Write the main program that allows you to do the following a) Create a robot which is initially in the position (10,150) and which turns towards the South then display the position and the orientation. b) Next, turn the robot right twice in succession, then display the position and orientation. c) Finally, move the robot two steps forward and then display the position and orientation. Solution
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