subject
Computers and Technology, 05.05.2020 22:16 dajahp

Project 4: Strictly Identical arrays

Problem Description:

Two arrays are strictly identical if their corresponding elements are equal. Write a program with class name StrictlyIdentical that prompts the user to enter two lists of integers of size 5 and displays whether the two are strictly identical.

Here are two sample runs:

Sample 1:

Enter 5 elements of list1: 23 55 31 2 10

Enter 5 elements of list2: 23 55 31 2 10

Two lists are strictly identical.

Sample 2:

Enter 5 elements of list1: 23 55 31 2 10

Enter 5 elements of list2: 23 55 3 2 10

Two lists are not strictly identical.

You need to define and utilize a user-defined function using the following method header:

public static boolean equals(int[] array1, int[] array2)

This method will return true if array1 and array2 are strictly identical otherwise it will return false. Note that it is incorrect to check the equality of two arrays using array1 == array2 because they are reference type variables. You need to use a for loop to check each element of array1 and array2. If any of the corresponding elements differ, these two lists are not strictly identical. If all of the corresponding elements are the same, these two lists are strictly identical.

You can use the following steps in your code:

Declare and create two arrays list1 and list2 of integer type and size 5.

Prompt the user to enter 5 elements of list1 and list2. Use for loop to read these entries and assign them to the elements of list1 and list2 respectively (for example, list1[i] = input. nextInt().)

Invoke the boolean method equals (that you defined) to pass the two arrays. If the return type is true then display that the lists are strictly identical. Otherwise, display that the two lists are not strictly identical.

What to deliver?

Your .java file including:

1. (Code: 5 points, Comments: 3 points)
Your code with other appropriate comments.

2. (2 points) Two sample run test the following lists:

(1) 1 2 3 4 5 and 1 2 3 4 5

(2) 1 2 3 4 5 and 5 4 3 2 1

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:50
A911 dispatcher is the sole sender of messages to all police officers. while on patrol, officers communicate with the dispatcher who, in turn, relays messages to other officers. the officers do not communicate directly with one another. this illustrates a network.
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
How are stop motion special effects in animated films created
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
Which explains extrinsic motivation? a)motivation in which there is a reward b)motivation that is personally satisfying c)motivation that is personally meaningful d)motivation in which the subject is interesting
Answers: 1
question
Computers and Technology, 24.06.2019 03:40
4. does the kernel phenotype distribution support the idea that the cob is the result of a dihybrid cross? what information supports your answer? if a dihybrid cross (i.e. f1 to f2 of standard mendelian crosses) is not indicated what conditions might contribute to this finding.
Answers: 2
You know the right answer?
Project 4: Strictly Identical arrays

Problem Description:

Two arrays are str...
Questions
question
Mathematics, 25.02.2021 18:10
question
Mathematics, 25.02.2021 18:10
question
Social Studies, 25.02.2021 18:10
question
Mathematics, 25.02.2021 18:10
question
Mathematics, 25.02.2021 18:10
question
English, 25.02.2021 18:10