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
LUCKY_DIMON [66]
4 years ago
13

Write a program that prompts the user to enter integers in the range 1 to 50 and counts the occurrences of each integer. The pro

gram should also prompt the user for the number of integers that will be entered. As an example, if the user enters 10 integers (10, 20, 10, 30, 40, 49, 20, 10, 25, 10), the program output would be:
Computers and Technology
1 answer:
galben [10]4 years ago
8 0

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        int num[] = new int[51];
  5.        Scanner input = new Scanner(System.in);
  6.        System.out.print("Number of input: ");
  7.        int limit = input.nextInt();
  8.        for(int i=0; i < limit; i++){
  9.            System.out.print("Input a number (1-50): ");
  10.            int k = input.nextInt();
  11.            num[k]++;
  12.        }
  13.        for(int j=1; j < 51; j++){
  14.            if(num[j] > 0){
  15.                System.out.println("Number of occurrence of " + j + ": " + num[j]);
  16.            }
  17.        }
  18.    }
  19. }

Explanation:

The solution is written in Java.

Firstly, create an integer array with size 51. The array will have 51 items with initial value 0 each (Line 5).

Create a Scanner object and get user entry the number of input (Line 6-7).

Use the input number as the limit to control the number of the for loop iteration to repeatedly get integer input from user (Line 9-13). Whenever user input an integer, use that integer, k, as the index to address the corresponding items in the array and increment it by one (LINE 11-12).

At last, create another for loop to iterate through each item in the array and check if there is any item with value above zero (this means with occurrence at least one). If so, print the item value as number of occurrence (Line 14-17).

You might be interested in
Consider that an individual threat agent, like a hacker, can be a factor in more than one threat category. If a hacker breaks in
pogonyaev
I think the answer is 5 categories but I am not sure
7 0
3 years ago
Software used the control a computer's hardware
s344n2d4d5 [400]
<span>Software used the control a computer's hardware is drivers. I.e Video, Sound, Printer etc.</span>
3 0
3 years ago
What is the "thinking work" of the computer? How does it help the computer?
anyanavicka [17]

Answer:

El pensamiento computacional es una forma de pensar que utiliza habilidades propias de las ciencias de la computación, como la descomposición y resolución de problemas, lógica, el reconocimiento de patrones y la abstracción

Explanation:

Un computador sirve para guardar los teléfonos de tus amigos, las tareas del colegio, los trabajos de tu papá y mamá y hasta las cartas que le envías a tu novia.

4 0
3 years ago
While recording a voice, if the narration is large,it is better to make a :a)a linked object b)an embedded object c)none d)does
goldenfox [79]

Answer:

c)none

Explanation:

Automatic updates can be a great problem in the case of the linked object and an embedded object. Hence, "a" and "b" are not the correct options, and since there is an effect, the d. the option is also not correct, as it does affect. And hence none of these options are correct. And the correct option is c) none.

4 0
3 years ago
1. ___________ ensures the integrity and security of data that are passing over a network.
allochka39001 [22]

Answer:

The correct answer to the following question will be Option D (Network-security protocols).

Explanation:

  • Methods and procedures for protecting network data from unwanted information retrieval are managed by network security protocols.
  • They are a network-style protocol that guarantees the protection and privacy of data in transit through a wireless connection. It describes procedures and techniques for protecting network data from every unauthorized effort to access or remove data material.

Therefore, Option D is the right answer.

5 0
4 years ago
Other questions:
  • Technician A says that as volume decreases, pressure increases. Technician B says that as temperature increases, pressure decrea
    5·1 answer
  • You want to centrally back up the files users store in the Documents folder in their user profiles, but you don’t want users to
    7·1 answer
  • While waiting to be seated at a restaurant, Jason receives a customer loyalty coupon through an app on his mobile phone for half
    7·1 answer
  • What are the differences between the various EHRs?
    9·1 answer
  • What effect does screen resolution have on how graphics are displayed?
    7·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • TABLE TEST
    12·1 answer
  • 3. It is used to measure the resistance on ohms and voltage that flow in circuit both AC and DC current. A. Gadget C. Electrical
    12·1 answer
  • A constraint that is concerned with cost and must be considered when designing is Group of answer choices Economic Aesthetic Pol
    6·1 answer
  • List and describe the 3 tasks learners can do in a Technology classroom.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!