Question: Task 5 ( Rotation ) Make the method public static void rotation ( char [ ] a ) . The method should rotate the
Task Rotation
Make the method public static void rotationchar a The method should "rotate the elements in a table.
A rotation is done by putting the last element first, and all other elements are shifted one step to the right.
The following example shows an application:
H II
A rotation in an empty table or table with exactly one element should not give an error message, but
the rotation will then do nothing.
Exercise Rotate several places
We continue here from the previous task, and will be able to rotate more than one step.
Create the method public static void rotationchar a int where is an arbitrary integer. If the
method must do the same as in the previous task.
If the method must give the same answer as if you use rotationa times. If is negative, the
rotation must go in the opposite direction. There is no limit to the size of
The method must be designed so that it is relatively effective. One of the tests will measure
efficiency on large tables. The following examples show areas of use:
charBCDEFGHIJ; rotation; a is now HIJABCD
EFG rotationa
; a is now JABCDEFGHI rotationa; a is now ABCDE
FGHIJ
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
