Urgent Please Help Me! [SOLVED] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Urgent Please Help Me! [SOLVED]

I have an assignment that I really having hard time to complete it. The requirement: use two arrays, source and destination. The last element, i.e. index 5 of source array will be inserted at the beginning, i.e. index 0 of destination array. The second last element, i.e. index 4 of source array will be inserted at the second element, i.e. index 1 of destination array. The process is repeated until all elements in source array is moved into destination array. import java.util.ArrayList; public class ReverseOrder{ private int size=0; private int destination[]; private int source[]; public ReverseOrder(int size){ // } public boolean isEmpty(){ // } public void insert(int value){ // } public void reverse(){ // } public void displaySource(){ System.out.println("\nPrinting source: "); if(isEmpty()){ System.out.println("\tArray is empty"); return; } for(int i=0; i<size; i++) System.out.print(source[i]+" "); } public void displayDestination(){ System.out.println("\nPrinting destination: "); if(isEmpty()){ System.out.println("\tArray is empty"); return; } for(int i=0; i<size; i++) System.out.print(destination[i]+" "); } public static void main(String[] args) { ReverseOrder ro = new ReverseOrder(4); ro.insert(1); ro.insert(2); ro.insert(3); ro.insert(4); ro.insert(5); ro.insert(6); ro.reverse(); ro.displaySource(); ro.displayDestination(); } } Another condition is all the code above can not be change, you can only implement code into these 4 methods, ReverseOrder(int size), public boolean isEmpty(), public void insert(int value), public void reverse(). I am trying to complete this as well but it does not give me

16th Mar 2019, 4:25 AM
Ms Kelly (TKL)
Ms Kelly (TKL) - avatar
4 Answers
+ 3
Good job! 👍 Now, please add [SOLVED] prefix to the question title, just to inform anyone browsing the forum that the case is solved : )
17th Mar 2019, 6:23 AM
Ipang
+ 2
I am trying to complete this as well but it does not give me the correct output. Please help me! Please all bro and sis here~
16th Mar 2019, 4:27 AM
Ms Kelly (TKL)
Ms Kelly (TKL) - avatar
+ 2
I found my own solution.
17th Mar 2019, 3:01 AM
Ms Kelly (TKL)
Ms Kelly (TKL) - avatar
0
can we have the solved full source code for this problem?
3rd Apr 2019, 12:47 AM
Malcolm Melvin
Malcolm Melvin - avatar