WRITE TO CONTROL THE ROBOT MOVES

WRITE TO CONTROL THE ROBOT MOVES

The primary theme of the paper is WRITE TO CONTROL THE ROBOT MOVES in which you are required to emphasize its aspects in detail. The cost of the paper starts from $109 and it has been purchased and rated 4.9 points on the scale of 5 points by the students. To gain deeper insights into the paper and achieve fresh information, kindly contact our support.

The Assessment Tasks

The specification for each task is set out below. Note these are requirements B to D are inclusive , i.e., the requirement set for Part D automatically meets all previous requirements from Parts A – C.

Standard Tasks

Part A The height of bars are pre-determined and set at 4.The height of the blocks are predetermined and set at 2.

Part B The user provides the heights of bars at runtime, but values supplied must be in the range 1 – 8.

Part C The user also provides the heights of blocks at runtime, but values supplied must be in the range 1 – 4. In addition the total height of all the blocks cannot exceed 12.

Part D The user can also specify and order in which the blocks should be placed at the destination.

Additional Task (Bonus marks)

Part E Part E requires you to specify the blocks in descending order of heights at the source. These blocks should be moved to the target with the limitation that a larger block cannot be placed on top of a smaller block.

 

Program Screenshots for Parts A to D

Part A: All blocks at source are of size 2 and all bars are of size 4.

Part B: All blocks at source are of height 2 as before but the bar heights may vary.

Part C: Block sizes can be specified in the range 1-4 Bar sizes can be specified in the range 1 to 8. Example Input: java Robot 543623 34121

Part D: This part allows user to specify the bar heights and block heights as well the order in which blocks must be placed in the Target. Example Input: java Robot 23456 2341 1234

Part E: This part specifies an additional ordering constraint which prevents a larger block being placed over a smaller block. Example Input: java Robot 543623 43321 ordered

Standard Requirements (20 marks in total)

A.Assume all the bars are of height 4 units and the blocks are of height 2 units respectively. Complete the control() method of the RobotControl class to move all the blocks to the respective targets.

(No input needed).

B.Allow the user to supply the heights of the 6 bars as command line arguments where the heights of the bars may vary from 1 to 8.

Complete the control() method of the RobotControl class to move all the blocks to the respective targets.

Sample input (bar heights): 734561. Based on these inputs, int array barHeights[] will be automatically set as in: barHeights[0] = 7; barHeights[1] = 3; …. barHeights[5] = 1;

C.Allow the user to supply the heights of the 6 obstacles as well as the height of the four blocks as command line arguments. Complete the control() method of the RobotControl class to move all the blocks to the respective targets.

Sample Input bar heights and block heights : 876054 2312.

Based on these inputs int arrays barHeights[], blockHeights[]) will be automatically set as in . barHeights[0] = 8; barHeights[1] = 7; …. barHeights[5] = 4;

blockHeights[0] = 2; blockHeights[1] = 3; … blockHeights[3] = 2;

D.Allow the blocks to be placed in the specified order. The required order will be passed as the array argument required[] which you can make use in the program.

Sample Input bar heights and block heights : 876054 2312 3221 barHeights[0] = 8; barHeights[1] = 7; …. barHeights[5] = 4;

blockHeights[0] = 2; blockHeights[1] = 3; … blockHeights[3] = 2; required[0] = 3; required[1] = 2; … required[3] = 1;

Bonus (5 Marks)

E.Allow the blocks to be moved such that a block cannot be placed over a smaller block. The block heights input therefore must therefore be in descending order.

Sample Input bar heights and block heights : 876054 3221 ordered

Up to half the marks can be earned by explaining the strategy for solving each section.

 

The code you need to write to control the Robot moves

For all four sections you are required to complete the control() method of the RobotControl class shown below. The control() method will be automatically called when the program is run. RobotControl class has a reference r set to refer to the Robot object. You are free to make use of other methods of your own.

class RobotControl

{private Robot r;

public RobotControl(Robot r)

{this.r = r;

}

public void control(int barHeights[], int blockHeights[],int required[], boolean ordered)

{// write your code and comments here

// to control robot using r.up(); r.extend() …

}

}

Arguments Passed to the control method

This method is also passed three arrays containing the heights of the bars (barHeights), the blocks (blockHeights) and the required order (required) (based on user input or default values). If the instructions you specify for the Robot result in hitting an obstacle or going beyond the limits, program will terminate immediately with an appropriate Error Message. The ordered variable (required only for part E) is set to true if the restriction requiring block to be placed to be smaller than the one underneath is to be enforced.

100% Plagiarism Free & Custom Written
Tailored to your instructions