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
Alex_Xolod [135]
3 years ago
11

write a program that takes 10 numbers as input and displays the mode of the numbers using parallel arrays and a method that take

s an array of numbers as a parameter and returns the value that appears most often in the array
Computers and Technology
1 answer:
irina [24]3 years ago
4 0

Answer:

The Java program is explained below

Explanation:

public class ArrayMode {

  public static int mode(int arr[]) {

      int maxValue = 0, maxCount = 0;

      for (int i = 0; i < arr.length; ++i) {

          int count = 0;

          for (int j = 0; j < arr.length; ++j) {

              if (arr[j] == arr[i])

                  ++count;

          }

          if (count > maxCount) {

              maxCount = count;

              maxValue = arr[i];

          }

      }

      return maxValue;

  }

  public static void main(String args[]) {

      int arr[] = { 9, 5, 3, 8, 5, 12, 19, 5, 11 };

      System.out.println("The set of numbers are: ");

      for (int i = 0; i < arr.length; i++)

          System.out.print(arr[i] + " ");

      System.out.println("\nThe mode of the set is: " + mode(arr));

  }

}

You might be interested in
Help!!!!!!!!!!!!!!!!!!!
ExtremeBDS [4]
Column if the answer.
6 0
3 years ago
What are some good digital habits?
kkurt [141]

ANSWER

1. Turn off all the notifications.

2. Set your phone to black and white.

5 0
2 years ago
Read 2 more answers
What is the effect of block size in cache design?
Sedaia [141]

Answer:

When designing a cache, you have to consider this things:

  • Delay.
  • Miss rate.
  • Area.

If the cache has a bigger block size may have a lower delay, but when miss the miss rate will be costly. If an application has high spatial locality a bigger block size will do well, but programs with poor spatial locality will not because a miss rate will be high and seek time will be expensive.

5 0
3 years ago
A microphone is a type of electronic.<br><br> True/Faulse
GenaCL600 [577]
Yes, True, a microphone IS a type of electronic
4 0
3 years ago
Que es la papirofobia​
PilotLPTM [1.2K]

Answer:

Aporofobia : temor obsesivo a la pobreza y de gente pobre.

4 0
2 years ago
Read 2 more answers
Other questions:
  • After a robbery, what is the purpose of conducting a neighborhood canvass?
    9·1 answer
  • <img src="https://tex.z-dn.net/?f=3x%20-%205%20%3D%203x%20-%207" id="TexFormula1" title="3x - 5 = 3x - 7" alt="3x - 5 = 3x - 7"
    12·1 answer
  • Question 14. (3.04 MC) how does the project manager evaluate the scope of a project
    14·1 answer
  • Is a type of bullying that takes place when a person intentionally posts negative information about another that is not true
    8·1 answer
  • What does the do not disturb button do on the iphone?
    12·1 answer
  • If there is a mistake with one of your bank accounts, who should you contact to resolve the issue
    14·1 answer
  • What will the following program display?
    15·1 answer
  • Explain the functions of a VDU?
    6·1 answer
  • The files in James's computer were found spreading within the device without any human action. As an engineer, you were requeste
    11·1 answer
  • Write code that outputs variable numCats. End with a newline.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!