1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sunny_sXe [5.5K]
3 years ago
14

Pass the two arrays to a method that will display the integer value(s), if any, that appear in both arrays (note that the two ar

rays can have no stored values in common). Save the file as ArrayMethodDemo.java.
Computers and Technology
1 answer:
vampirchik [111]3 years ago
5 0

Answer:

The solution code is written in Java

  1.    public static void checkCommonValues(int arr1[], int arr2[]){
  2.        if(arr1.length < arr2.length){
  3.            for(int i = 0; i < arr1.length; i++){
  4.                for(int j = 0; j < arr2.length; j++){
  5.                    if(arr1[i] == arr2[j]){
  6.                        System.out.print(arr1[i] + " ");
  7.                    }
  8.                }
  9.            }
  10.        }
  11.        else{
  12.            for(int i = 0; i < arr2.length; i++){
  13.                for(int j = 0; j < arr1.length; j++){
  14.                    if(arr2[i] == arr1[j]){
  15.                        System.out.print(arr2[i] + " ");
  16.                    }
  17.                }
  18.            }
  19.        }
  20.    }

Explanation:

The key idea of this method is to repeated get a value from the shorter array to check against the all the values from a longer array. If any comparison result in True, the program shall display the integer.

Based on this idea, an if-else condition is defined (Line 2). Outer loop will traverse through the shorter array (Line 3, 12) and the inner loop will traverse the longer array (Line 4, 13). Within the inner loop, there is another if condition to check if the current value is equal to any value in the longer array, if so, print the common value (Line 5-7, 14-16).

You might be interested in
A 30V battery maintains a current through a 10 Ω Resistor. What is the current flow through the resistor?
Troyanec [42]

Answer:

3 amps

Explanation:

because as per ohm's law. "electric current is proportional to voltage and inversely proportional to resistance"

7 0
3 years ago
Your license can be canceled if you __________
Elena L [17]
Its B i think hope this helps ! 
8 0
3 years ago
Read 2 more answers
Individually or in a group find as many different examples as you can of physical controls and displays.a. List themb. Try to gr
Angelina_Jolie [31]

Answer:

Open ended investigation

Explanation:

The above is an example of an open ended investigation. In understanding what an open ended investigation is, we first of all need to understand what open endedness means. Open endedness means whether one solution or answer is possible. In other words it means that there may be various ways and alternatives to solve or answer a question or bring solution to an investigation.

From the definition, we can deduce that an open ended investigation is a practical investigation that requires students to utilize procedural and substantive skills in arriving at conclusion through evidence gathered from open ended research or experiment(as in not close ended, not limited to ready made options, freedom to explore all possibilities). This is seen in the example question where students are asked to explore the different examples of physical controls and displays and also discuss their observations. Here students are not required to produce a predefined answer but are free to proffer their own solutions

7 0
3 years ago
. Create an abstract Dollar class with two integer attributes, both of which are non-public (Python programmers - it is understo
aksik [14]

Answer:

Explanation:

The following code is written in Java. It creates the abstract dollar class that has two instance variables for the dollars and the coins that are passed as arguments. The test output can be seen in the picture attached below.

class Dollar {

   int dollars;

   double coin;

   private Dollar(int dollar, int coin) {

       this.dollars = dollar;

       this.coin = Double.valueOf(coin) / 100;

   }

   

}

4 0
3 years ago
To clear a filter, click the ____ button on the home tab and then click clear all filters.
Shtirlitz [24]
Advanced button

Filter is important to see the data you want displayed only. In order to clear all filters in Access, click the Home tab, select Sort and Filter group option, click ADVANCED and then proceed to Click ALL Filters
5 0
3 years ago
Other questions:
  • You have decided to remove a recently installed feature which method can you use to remove this feature
    13·1 answer
  • Name at least two types of career options that are available for someone with strong typing skills?
    10·2 answers
  • What kind of physical device is an evil twin access point? What does the evil twin do after initial association when the victim
    12·1 answer
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • Ellen is expecting to get a 3% raise next year. She enters .03 in cell D2 so that she can predict her monthly income for the nex
    12·1 answer
  • I have been charged for brainly plus yet I still have to watch ads why? What do I do?
    12·2 answers
  • Please help! I tried this by myself. But I am not sure if this is right.
    8·2 answers
  • NumA = 3 <br>numB = 2<br>Result = numA ** numB
    12·1 answer
  • What is the exclusive legal right granted to all authors and artists that gives them sole ownership of their work to print, publ
    5·2 answers
  • Your company has a team of remote workers that need to use Windows-based software to develop company applications, but your team
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!