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
Briefly describe the interface between the memory and the processing unit. That is, describe the method by which the memory and
xxMikexx [17]

Answer:

The memory and the processing unit communicate through the Memory Address Register (MAR) and the Memory Data Register (MDR).

Explanation:

7 0
4 years ago
Use the drop-down menus to complete statements about archiving and backing up data fileArchiving data files manages the size of
svetoff [14.1K]

Answer:

Archiving data files manages the size of a mailbox for  

✔ local

storage.

Creating an Outlook data file  

✔ protects

data files in storage on a computer.

Explanation:

Because its right.

3 0
3 years ago
Read 2 more answers
All of the following are forms of verbal communication except
Radda [10]
B. hand gestures
these are not verbal.
4 0
3 years ago
Read 2 more answers
What form of contacts can be shared in Outlook 2016?
ArbitrLikvidat [17]

Answer:

shared contacts

Explanation:

5 0
3 years ago
Read 2 more answers
FREEE POINTS
BigorU [14]

Answer:

Thank you that's so very kind of you. Hope your having a good day.

3 0
3 years ago
Read 2 more answers
Other questions:
  • "If a VM is given exclusive access to hardware devices on the host computer, what new Windows Server 2016 feature is being utili
    14·1 answer
  • The procedure call mystery(38) will yield which output? __________ a) 0 12 b) 12 0 c) 1 1 0 2 d) 1 1 1 1 e) 2 0 1 1 public void
    11·1 answer
  • What was the Messana conflict
    7·1 answer
  • Which license enables anyone on the network to install and use the software?
    14·1 answer
  • A user is connecting to an e-commerce server to buy some widgets for a company. the user connects to the site and notices there
    10·1 answer
  • In csma/ca, the amount of time a device is made to wait before it can transmit is called the ____.
    15·1 answer
  • What is nominal data?
    5·1 answer
  • Which of the following is similar to defense in depth and supports multiple layers of security?a. Defense in depthb. Diversity o
    7·1 answer
  • In Java please:Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum &gt; 0) Syste
    10·1 answer
  • 20 POINTSS!! NEED HELP!!
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!