$25
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]
a) Print the elements
b) Copying an array
c) Resizing an array
d) Reversing an array
e) Shifting an array left
f) Shifting an array right
g) Inserting an element at any position
h) Removing an element from any position
i) Rotating an array left
j) 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
A = (X+1)_John_(Y+10)
B = (X+2)_John_(Y+20) C = (X+3)_John_(Y+30) D = (X+4)_John_(Y+40)
E = (X+5)_John_(Y+50)
F = (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]
a) Print the elements
b) 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+…)
c) Reverse the array
d) Shifting array left by one position
e) Shifting array right by one position
f) Inserting an element [in position = Last 3 digit of your id %7]
g) Removing an element [in position = Last 3 digit of your id %5 ]
h) Rotating array left by X position [X = Last 3 digit of your id %5]
i) Rotating array right X position [X = Last 3 digit of your id %5]
j) Inserting an element [in position = Last 3 digit of your id %10]
k) Removing an element [in position = Last 3 digit of your id %9 ]