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]
3 years ago
8

Please write a Java program.

Computers and Technology
1 answer:
Marianna [84]3 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
TRUE/FALSE: In order to use an object in a program, its class must be defined.
FinnZ [79.3K]
Yes that is correct. True
3 0
3 years ago
What is a specific challenge faced by information visualization researchers who are building an interface?
Mkey [24]

Answer:

 Information virtualization is the process of representing the abstract data such as numeral number and text into the form of visual which is human can easily understand.

The main challenges faced by the information visualization researchers are:

  • The main challenge which are faced by the information virtualization is during the data importing and also cleaning in the system.
  • It also not able to access the large amount of the data easily from the system.
  • Due to the poor selection of the scale and the coordinate rotation it also lead to the data distortion.
3 0
3 years ago
19) If you want to find your lowest paid, full time employee (with "FT" in column B and each employee's salary found in column C
Vadim26 [7]

Answer:

MAXIF

Explanation:

The MAXIF function is a function used in Ms Excel.

  • This function indicates the maximum value located on an array .

Option B

7 0
2 years ago
Read 2 more answers
What is the role of the digital cinematographer?
dlinn [17]
<span> is the person in charge of actually shooting the film. He is the head of the camera and lighting departments, and as such he has a big </span>role<span> in the making of any movie

</span>
3 0
3 years ago
Read 2 more answers
The Internet has been around for quite a while, but it did not have much impact on our everyday lives until the appearance of th
pishuonlain [190]

Answer:

The answer is "WWW".

Explanation:

WWW stands for World Wide Web, It is a combination of all Internet resources and users, that uses the hypertext transfer protocol. It provides world information that is available on the internet that is the expression of human knowledge. It is also known as a domain name that introduces resources or individual instances of the entire collection.

6 0
3 years ago
Other questions:
  • Choose the correct sequence for classifier building from the following.
    7·1 answer
  • You can use automatic link-checking software to identify invalid hyperlinks. if you find invalid links, what should you do next?
    13·1 answer
  • Write a function in MATLAB that takes as an input a matrix of coefficients for a system of linear equations (A), the solution ve
    15·1 answer
  • On other questions, how do I write my own question, without commenting on others questions? It is only allowed two, I think, the
    13·1 answer
  • A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
    15·2 answers
  • Which of the following is an example of hypertext pattern reading?
    13·1 answer
  • Why is it important to protect people's intellectual property online?
    10·1 answer
  • Select the online reading comprehension tool that best fits the description. This tool lets users change text from one language
    6·2 answers
  • What is meant by versatility in terms of features of computer?​
    9·2 answers
  • The New option is found in the ...............tab.​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!