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
astraxan [27]
2 years ago
8

Please write a Java program.

Computers and Technology
1 answer:
Marianna [84]2 years ago
5 0

Answer:

public class Main

{

public static void main(String[] args) {

 int[] arr = {3, 1, 1, 2, 4, 4, 4, 6};

 

 int[] o = countOccurance(arr);

 for (int x: o)

     System.out.print(x + " ");

}

public static int[] countOccurance(int[] arr){

    int[] occ = new int[6];

    for (int x: arr)

        occ[x-1]++;

   

    return occ;

}

}

Explanation:

Create a function called countOccurance that takes one parameter, an array

Inside the function, initialize an array, occ, to hold the occurance counts

Create a for each loop to iterate the array, and increment the occurance of the numbers

When the loop is done, return the occ array

Inside the main, initialize an array

Call the function countOccurance and set it to a new array, o

Print the elements of the o to see the number of occurances of the numbers

You might be interested in
Four major parts of the keyboard
harina [27]

Answer:

alphabetical keys, function keys, cursor keys, and the numeric keypad

Explanation:

5 0
3 years ago
Read 2 more answers
_____ is a systems development technique that produces a graphical representation of a concept or process that systems developer
natima [27]

Answer:

D. Modeling

Explanation:

Based on the information provided within the question it can be said that the term that is being described is called Modeling. This is a technique or method of constructing graphical models in order to better visualize a concept and construct the systems that will be needed or built in the business and/or development process.

4 0
2 years ago
All of the following are vertical alignment options except __middle , top, center, or_bottom_.
Dominik [7]
<span>All of the following are vertical alignment options except middle, whereas top, center, and bottom are vertical alignment options. </span>
3 0
3 years ago
Which of the following best describes the basic purpose of the internet?
Julli [10]
The answer is B! Hoped this helped!
6 0
2 years ago
Which company provides a crowdsourcing platform for corporate research and development?
777dan777 [17]

Answer:

OA.

MTurk(mechanical turk)

Explanation:

Mechanical Turk is a Microwork service provided by Amazon. Correct answer: C It is an online “crowdsourcing” marketplace that was launched in 2005 by Amazon.

This site (service)   allows businesses and individuals to post short tasks and pay workers to complete them.

6 0
3 years ago
Other questions:
  • Which of the following is NOT a common GUI component? O a. Label b. Button c. Key press d. Text box
    12·2 answers
  • As yall know its spoopy season. This means spoopy music! I am having a live stream on the Spoon app under the username teendrago
    11·1 answer
  • Draw the cache tables and the state of all bits within them. Suppose you have a 16 byte cache with 2 byte long cachelines that i
    6·1 answer
  • If you're using the paintbrush tool and want to change the color of the paint being used what should you change
    6·1 answer
  • Which buttons should you use to publish and change a message on a message board
    6·2 answers
  • How is kerning used in Word?
    7·2 answers
  • True or False: <br> The object reference can be used to polymorphically store any class in Java.
    13·1 answer
  • The radix sort
    7·1 answer
  • Write a function process_spec that takes a dictionary (cmap), a list (spec) and a Boolean variable (Button A) as arguments and r
    10·1 answer
  • 20 points for ez question lol
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!