Description
Task 1:
Given array is –
| X-18 | X+4 | X | X+14 | X-5 | X+4 | X-2 | X+9 |
X= Last 4 digit of your BRACU ID % 33 + Last 4 digit of your BRACU ID % 34
Write a java code for linear array which has below 10 functionalities and trace your code. Include the tester file and write the output array after each operation.
[Hint1: In one java class you have to implement all the methods]
[Hint2: All tasks should be implemented on the same instance of the array]
- Print the elements
- Copying an array
- Resizing an array
- Reversing an array
- Shifting an array left
- Shifting an array right
- Inserting an element at any position
- Removing an element from any position
- Rotating an array left
- Rotating an array right
Task 2:
Given array is –
| X | A | B | C | D | E | F |
Where,
X = Last 4 digit of your id % 33 + Last 4 digit of your id % 34 Y = Last 3 digit of your id % 33 + Last 3 digit of your id % 34
- = (X+1)_John_(Y+10)
- = (X+2)_John_(Y+20) C = (X+3)_John_(Y+30) D = (X+4)_John_(Y+40)
- = (X+5)_John_(Y+50)
- = (X+6)_John_(Y+60)
// john will be replaced with your name initials. Example: Mofiz Uddin Khan -> initial MUK
Perform the following operations and show simulation (i.e write the resulting array). Write the final output after each operation. No need to write the code.
[Hint: All tasks should be implemented on the same instance of the array]
- Print the elements
- Resizing the array [new length = Last 4 digit of your id %5 + Last 3 digit of your id %3 + 8] and fill the elements according to the given order .. (X+…)_John_(Y+…)
- Reverse the array
- Shifting array left by one position
- Shifting array right by one position
- Inserting an element [in position = Last 3 digit of your id %7]
- Removing an element [in position = Last 3 digit of your id %5 ]
- Rotating array left by X position [X = Last 3 digit of your id %5]
- Rotating array right X position [X = Last 3 digit of your id %5]
- Inserting an element [in position = Last 3 digit of your id %10]
- Removing an element [in position = Last 3 digit of your id %9 ]




