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
Murljashka [212]
3 years ago
15

Write a program that reads an arbitrary number of integer that are in the range 0 - 50 inclusive and counts how many occurrences

of each are entered. Indicate the end of the input by a value outside of the range. After all input has been processed, print all of the values (with the number of occurences) that were entered one or more times.

Computers and Technology
1 answer:
Anna [14]3 years ago
7 0

Answer:

Check the explanation

Explanation:

import java.util.Scanner;

public class Count

{

   public static void main(String[] args)

   {

       // creating array of store to store count of

       //every integer entered

       int[] store = new int[51];

       System.out.println("Enter any integers between"+

       " 0 and 50, and if you are done then enter any"+

       " integer out of the range");

       System.out.println("Enter Integer: ");

       //taking input of first integer

       Scanner scan = new Scanner(System.in);

       int integer = scan.nextInt();

       //looping for integers entered in range

       //to count its occurance

       while(integer >= 0 && integer <= 51)

       {

           //adding count to 'store' array of that

           //particular array of value entered

           store[integer] = store[integer] + 1;

           System.out.println("Enter Integer: ");

           integer = scan.nextInt();

       }

       //printing number of times each integer is entered

       System.out.println("printing number of times"+

           " each integer is entered");

       for (int i=0; i < 51; i++)

       {  

           if (store[i] > 0)

               System.out.println(i + ": " + store[i]);

       }

   }

}

Kindly check the result below

You might be interested in
Which XXX will prompt the user to enter a value greater than 10, until a value that is greater than 10 is actually input?
aleksley [76]

Answer:

b. (userInput < 10)

Explanation:

The piece of code that will accomplish this would be (userInput < 10). The code will first ask the user to "Enter a number greater than 10:" then it will compare the value of userInput to 10, if it is less than 10 it will redo the loop over and over again until the userInput is greater than 10. Once the userInput is greater than 10 it will break out of the do-while loop and continue whatever code is written under and outside the do-while loop

4 0
3 years ago
Select the tips you should follow when creating a newsletter.
podryga [215]

When creating a newsletter, it is best to have a guideline and follow tips in making a more creative newsletter that will make readers or audiences hook up. The following tips that an individual should follow when creating a news letter are the following:

-          It is best to be clear and concise when writing

-          Be straight and to the point

-          Be emphatic, by having to know the readers or your audiences.

3 0
4 years ago
Compare and contrast the uses of NetWitness Investigator and Wireshark used in the lab. Why would a network administrator use Wi
Ahat [919]

<u>Explanation:</u>

Note, the Wireshark software application is unique in that it has the ability to perform multiple layers of individual packet analysis.

Whereas in NetWitness Investigator software application, even though it doesn't go deeper like Wireshark, it can still detect new threats or problems in a network and then organized all of such information for the administrator.

So, in a sense, by using both applications, a network administrator can find the problems (using Wireshark), while another application (NetWitness Investigator) organizes them for him.

3 0
3 years ago
Most common level of education for a programmer or software developer
shusha [124]

c/c+ also java would be one

8 0
3 years ago
PLEASE HELP!
Morgarella [4.7K]
An query because his ideas are effective
8 0
4 years ago
Read 2 more answers
Other questions:
  • The natural functions of Earth seem all _____ in one way or another.
    9·1 answer
  • Suppose you have the following declaration.int[] beta = new int[50];Which of the following is a valid element of beta.(i) beta[0
    14·1 answer
  • What is the printout for the first statement in the main method?
    13·1 answer
  • You want to write a Python program to compute the average of three integer quiz grades for a single student. Decide what variabl
    8·1 answer
  • Which of the following best describes when a packet is addressed so that more than one destination can receive it and the first
    11·1 answer
  • 1. (1 pt) Suppose you wish to run a program P with 37.5 x 109instructions on a 15 GHz machine with a CPI of 0.75. What is the ex
    9·1 answer
  • How to post a answer
    7·1 answer
  • PLZ HELP ME!!
    8·2 answers
  • True or False: the sky looks blue because it is reflecting the blue ocean.​
    12·2 answers
  • What validation type would you use to check that numbers fell within a certain range? a) range check b)presence check c)check di
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!