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
PLZ HELP I AM TIMED!!!!
Nataliya [291]

Answer:

The correct answer is A.

Explanation:

I put D from the answer above and got it wrong and it said A was the correct answer. haha :)

4 0
2 years ago
Read 2 more answers
In an ha configuration, which two failure detection methods rely on icmp ping? (choose two.)
Hunter-Best [27]
I believe that the multiple questions attached to this question is 

a) Hello
b) Link groups
c) Path groups
d) Heartbeats

The Answer is B and C
The physical interfaces that are supposed to be monitored are connected into a link group and a firewall failure can be triggered when one or all physical interfaces in the group failPath Monitoring helps monitor the full path to mission critical IP addresses. By default, any one of the IP addresses becoming unreachable will end up causing the firewall to change the HA to tentative state
7 0
2 years ago
Consider the security of a mobile device you use
Alekssandra [29.7K]

Answer:

keep it private

Explanation:

7 0
2 years ago
What permissions are needed in order to use a work online that is in the public domain?
Maurinko [17]
<h2 /><h2>⇒Written  \: permission  \: from \\  the  \: creator</h2>

The term “public domain” refers to creative materials that are not protected by intellectual property laws such as copyright, trademark, or patent laws. ... Anyone can use a public domain work without obtaining permission, but no one can ever own it.

5 0
2 years ago
I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha
Bingel [31]

Answer:

public class Triangle

{

public static void main( String[] args )

{

show( 5 );

}

public static void show( int n )

{

int i,j,k;

for (i = 0; i < n - 1; i++ )

{

for (j = 0; j < i; j++ )

{

System.out.print( " " );

}

for (k = n - i; k > 0; k-- )

{

System.out.print( "* " );

}

System.out.println();

}

for (i = 0; i < n; i++ )

{

for (j = n - i; j > 1; j-- )

{

System.out.print( " " );

}

for (k = 0; k < i + 1; k++ )

{

System.out.print( "* " );

}

System.out.println();

}

4 0
2 years ago
Other questions:
  • A firewall is either software or dedicated hardware that exists between the __________ being protected.
    13·1 answer
  • An item such as a smart card is an example of the _______ form of authentication.
    10·1 answer
  • If $hourlyWage contains the value 10.00 and $hoursWorked contains the value 20, what value will $bonus contain after the followi
    11·1 answer
  • Select the correct answer.
    8·2 answers
  • Write a shell script called SpellOutDate that prints the detail of the current date in separate lines. For example if the curren
    13·1 answer
  • Who know's web Design
    12·1 answer
  • 9.19 LAB: Words in a range (lists) Write a program that first reads in the name of an input file, followed by two strings repres
    6·1 answer
  • What is keyword density?
    15·2 answers
  • What is an advantage of using a fully integrated cloud based data analytics platform
    5·1 answer
  • The terminology used to describe a possible path to resolution to a problem from one end to the other is called what?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!