Question: How would I make a program like this : Prompts the user to input the size of two arrays list1 and list 2 and inserting


How would I make a program like this :

  1. Prompts the user to input the size of two arrays list1 and list 2 and inserting the integers in them (by the user).
  2. Then, invoke a "Output" method to send the arrays as arguments and print the list1 and list2 in the method ("Output").
  3. Then, call another method "compare" to see if the both arrays have same elements. If both arrays have same elements, 1 must be retuned to the "compare" method, else -1 must be returned. Based on the return value (1 or -1) print if the arrays are equal or not. Note: you cannot use any build-in method to compare elements of the arrays. 
  4. Then, Call another method "compareReverse" and send the array list1 as argument in the method "compareReverse" . In "compareReverse", see if the elements in the list1 are same, if we read (list1) the elements in the reverse order.  In the "compareReverse" call a "printAnswer" method to print if the comparison (same in the reverse order or not). For example: (list 1: 2 3 3 2) will print same elements in the reverse order.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an example of how you can create a program that follows the described steps in JavaScript javascript Prompt the user to input the size of the ar... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!