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]
4 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]4 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
Antivirus is a program that detects error.True or False.​
Vaselesa [24]

Answer:  false

Explanation:

Because it isn't true.

5 0
3 years ago
Hey! I was recommended a site “9anime” the other day. All’s been going well but I accidentally taped on a new dub settingZ somet
Studentka2010 [4]

Answer:

yep defiantly virus

Explanation:

8 0
3 years ago
Read 2 more answers
Most airlines use very modern hardware and software.<br><br><br> True<br><br> False
torisob [31]
True definitely. They have to use very modern tech in order to make people trust and use them.
3 0
4 years ago
Earth's current era is the _______ era.
natita [175]
We are in the Cenozoic Era
6 0
4 years ago
Read 2 more answers
Why do we need to update database regularly
sergiy2304 [10]
To protect from attackers gaining access by sitting on a certain configuration too long. 
7 0
3 years ago
Other questions:
  • 1. Customizable diagrams, including List, Process, and Cycle diagrams, are built into Word and can be found in
    15·2 answers
  • On the CallCenterReport worksheet, add formulas that will summarize the issues for the department entered in cell B3. In cell B6
    13·1 answer
  • What are the four basic operating principles of the information processing cycle?
    7·2 answers
  • For what reasons would someone use online reading tools? Check all that apply. to enhance critical-thinking skills to improve un
    5·2 answers
  • How do i get more coding programs
    14·2 answers
  • Images are available in many formats, such as tif, bmp, gif, jpeg, and ____.
    5·1 answer
  • Which keys should you press to insert a comment in OpenOffice Writer?
    15·2 answers
  • Public class Dog
    7·1 answer
  • What is 3x10? PLZZZZZ
    11·1 answer
  • Briefly describe the function of options in a linux command and give an example of a useful option.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!