Hi all,
I will show you the solution of question , Sometime i have problem in implement the code in BlueJ but i understant what they want frome me in question. this is question
1/ Write a method that takes an array of floats and right shift the numbers one step.
public float ShiftR(float N,float[] arr){
int i = 0;
int j = arr.length -1;
while(i<=j){
int finalNomber =(j)+1;//----------->move to first index
if (N==arr[finalNomber])
i++;
j--;}
}
2/ Write a method that takes an array of floats and left shift the numbers one location.
public float ShiftL(float N,float[] arr){
int i = 0;
int j = arr.length -1;
while(i<=j){
int firstNomber =(i)+arr.length -1;//----------->move to Final index
if (N==arr[firstNomber])
i--;
j++;}
}
when i did it in Bluej it say no wrong , please tell me if my work is right and can you plese tell me the step to test this code