Question
Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts
Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts the users to enter the array size. Then prompts the user to initialize each array with integer values. The program defines method Compare() that takes two signal-dimensional arrays of type integer. The method compares the content of the arrays and returns true (Boolean type) if the arrays store same values in the same order. Otherwise, it returns false. The program main method calls method Compare()and prints the result from the method as shown below. Document your code and organized your output following these sample runs.
Sample run 1:
Array size: 4
First array: 23, -45, 78, 10
Second array: 23, -45, 78, 10 Judgment: The arrays are identical
Sample run 2:
Array size: 5
First array: 78, 128, 300, 12, 300
Second array: 78, 128, 12, 300, 300 Judgment: The arrays are not identical
Sample run 3:
Array size: 1
First array: 0
Second array: 0 Judgment: The arrays are identical
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started