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, 21.06.2019 16:00
Choice of type is influenced primarily by these two factors?
Answers: 3
question
Computers and Technology, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
question
Computers and Technology, 24.06.2019 20:30
Where is permanent data in the computer stored whenever gym starts his laptop he sees some commands in numbers appearing on the screen these instructions are being preceded by the control unit in
Answers: 1
You know the right answer?
Project 4: Strictly Identical arrays

Problem Description:

Two arrays are str...
Questions
question
Arts, 11.05.2021 20:10
question
English, 11.05.2021 20:10
question
Mathematics, 11.05.2021 20:10
question
Advanced Placement (AP), 11.05.2021 20:10
Questions on the website: 13722359