Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions