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
Research the disadvantages of the computer and explain them.​
lisabon 2012 [21]

Answer:

Too much sitting-affects the back and makes our muscles tight

Carpal tunnel and eye strain-moving your hand from your keyboard to a mouse and typing are all repetitive and can cause injuries

Short attention span and too much multitasking-As you use a computer and the Internet and get immediate answers to your questions and requests, you become accustomed to getting that quick dopamine fix. You can become easily frustrated when something doesn't work or is not answered in a timely matter.

3 0
4 years ago
What are the layers in the internet protocol stack? what are the principle responsibilities of each of these layers?
Andrew [12]
1: Application
2: Presentation
3:Session
4: Transport
5:Network 
6: Data link 
7: Physical

Application is a Interface Layer and responsible Layer
<span />
3 0
3 years ago
Jordan says she cant access files on the server any more. No other user has reported this problem and she can PING the server fr
kramer

Answer:

Lan cable was disconnected or unplugged from jordan's PC

Explanation:

According to the scenario, no user other than Jordan has reported the problem which means that there was no issue in the network or server.

As IP address ping of 127.0.0.1 was successful means that the configuration of the IP address was also correct and the DHCP server was working correctly.

After all assessment one of the main cause could be the disconnection of the LAN cable from Jordan's computer.

6 0
3 years ago
In VBA, write a code that does as follows: The first worksheet ("Ex. 1") has a list of 50 numbers. Write a program that will rea
leva [86]

The answer & explanation for this question is given in the attachment below.

8 0
3 years ago
Random-access memory (RAM) is able to quickly access data because it is arranged in which of the following configurations?
lianna [129]

Answer:

A two-dimensional grid consisting of rows and columns of memory cells

Explanation:

Radom access memory is made of bits of data or program code that are tactically arranged in a two-dimensional grid. DRAM will store bits of data in what's called a storage, or memory cell, consisting of a capacitor and a transistor. The storage cells are typically organized in a rectangular configuration.

7 0
3 years ago
Other questions:
  • What type of encoding is this?<br>0x6a656c6c7966697368<br>cause I'm trying to decode it
    5·1 answer
  • What can you do to make sure you have a healthy credit report
    13·2 answers
  • Which of the following is used to encrypt web application data?
    11·1 answer
  • "list at least 3 key performance indicators that should be considered prior to initiating a cloud deployment."
    15·1 answer
  • . One of the vulnerabilities the Morris worm used was a networking service called finger. The purpose of the finger service is t
    11·1 answer
  • History timeline: who developed what elements first Windows OS and Apple OS?
    13·2 answers
  • The details of various measurable characteristics related to IT outcomes of a cloud environment, are typically expressed in a
    6·1 answer
  • 40 points
    5·2 answers
  • In what real-life situations might you want to use the modulus operation in a program?
    15·1 answer
  • where element is the Hypertext Markup Language (HTML) element and _____ pairs define the styles that are applied directly to tha
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!