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
You connect your computer to a wireless network available at the local library. You find that you can access all of the websites
leva [86]

Answer:

There must be a  proxy server that is not allowing access to websites

Explanation:

A wireless network facility provided in colleges, institutions, or libraries is secured with a proxy server to filter websites so that users can use the network facility for a definite purpose. Thus, that proxy server is not allowing access to all of the websites to the user on the internet except for two.

4 0
2 years ago
A medical assistant at a local hospital is exploring the Start Menu of his/her computer and various Windows programs/application
Ratling [72]
<span>Five questions that people are most likely to ask about the application are as follows:1. What is the use and function of this application?. 2. Who is this application for? 3. How much does this application cost?. 4. Where can the application been used? and 5. Why should I use this application? </span>
7 0
2 years ago
(Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last
Aneli [31]

Answer:

 The solution code is written in Python 3

  1. digits = input("Enter 9 digits: ")
  2. multiplier = 1
  3. total = 0
  4. for x in digits:
  5.    total += int(x) * multiplier  
  6.    multiplier += 1
  7. checksum = total % 11  
  8. if(checksum == 10):
  9.    print(digits + "X")
  10. else:
  11.    print(digits + str(checksum))

Explanation:

Firstly, use input function to get user input for 9 digits (Line 1)

Next we can use a for-loop to estimate the summation (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5+ d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) ( Line 6-8)

Then only apply % operator to get the remainder of total and get the checksum (Line 10)

Next create if and else statement to print the digits string joined with X if checksum is 10 else join digits string with checksum value (Line 12 -15)

7 0
3 years ago
You used a website to learn about the child-rearing practices in China. Your study is related most to which aspect
ozzi

Answer:

c. culture

Explanation:

I think your study is related to their culture

5 0
2 years ago
Read 2 more answers
Help me pleaseeee!
kenny6666 [7]

Answer:

Try checking around on the router!

Explanation:

Assuming they haven't changed it, most routers have their default password displayed somewhere on it. I hope this helps!! ^^

5 0
2 years ago
Read 2 more answers
Other questions:
  • WHOEVER HELPS ASAP GETS BRAINLiEST!!!!!!!!! :)
    15·2 answers
  • True are fulse A piece of information that is considered common knowledge does not need a citation
    5·2 answers
  • What is A wage paid based on the ability to sell a product or service is (a) _____.
    9·1 answer
  • If you have a charger that’s not from Apple, then could that damaged your iPhone or not?
    5·1 answer
  • What type of Microsoft Server serves as an email server?
    7·2 answers
  • Define the missing function. licenseNum is created as: (100000 * customID) licenseYear, where customID is a function parameter.
    12·1 answer
  • Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
    10·1 answer
  • Compile and Execute a Program
    13·1 answer
  • Which one do we use to send signals as IR light waves?
    11·1 answer
  • The first person to say something in here will get brainliested.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!