answer.
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
Maslowich
2 months ago
15

Write a for loop to populate array userguesses with num_guesses integers. read integers using scanner. ex: if num_guesses is 3 a

nd user enters 9 5 2, then userguesses is {9, 5, 2} java
Computers and Technology
2 answers:
maria [1K]2 months ago
6 0
import java.util.Scanner; public class StoreGuesses { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); final int NUM_GUESSES = 3; int[] userGuesses = new int[NUM_GUESSES]; for (int i = 0; i < NUM_GUESSES; ++i) { userGuesses[i] = scnr.nextInt(); } for (int i = 0; i < NUM_GUESSES; ++i) { System.out.print(userGuesses[i] + " "); } } }
oksian1 [950]2 months ago
3 0

Respuesta:

Para mostrar las adivinanzas numéricas en el arreglo user_guesses, primero es necesario declarar la variable num_guesses y asignarle el valor 3. Luego, se almacenan las adivinanzas en el arreglo user_guesses. Después, se define un ciclo for que itere hasta num_guesses. Finalmente, se imprimen los valores almacenados usando una instrucción de impresión.

Explicación adicional:

A continuación se presenta un programa JAVA que llena el arreglo user_guesses con enteros indicados.

Código:

import java.util.Scanner;

// definición de clase

public class NumberGuesses {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

// inicializar variable num_guesses en 3

final int num_guesses = 3;

// reservar espacio en arreglo para las adivinanzas

int[] user_guesses = new int[num_guesses];

int i = 0;

// declaración del ciclo for

for (i = 0; i < num_guesses; ++i) {

user_guesses[i] = scnr.nextInt();

}

for (i = 0; i < num_guesses; ++i) {

// imprimir resultados

System.out.print(user_guesses[i] + " ");

}

}

return;

}

You might be interested in
Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w
zubka84 [1067]

Answer:

The code placed where "/*Your solution goes here */" is as follows:

while(numInsects<200) // while loop

       {

            System.out.print(numInsects+" "); // output statement

            numInsects=numInsects*2; // operation to double the value.

       }

Output:

  • If the input is 16, the result is 16 32 64 128.
  • If the input is 25, the result is 25 50 100.

Explanation:

  • The above Java code fills the section designated as "Your solution" and will operate correctly.
  • The program accepts a user input and continues to print double the value until it reaches 200 or more.
  • The while loop evaluates whether the value remains below 200. If so, the operation proceeds; otherwise, it stops.
5 0
1 month ago
The Coins class was created to hold all your loose change, kind of like a piggy bank! For this exercise, you are going to simula
Amiraneli [1052]

Answer:

Coins c1 = new Coins (4, 3, 2, 1);

c1.bankValue();

c1.addQuarter();

c1.addQuarter();

c1.addDime();

c1.addDime();

c1.addPenny();

c1.bankCount();

c1.bankValue();

Explanation:

8 0
28 days ago
The Domain Name System (DNS) provides an easy way to remember addresses. Without DNS, how many octets for an Internet Protocol (
Harlamova29_29 [1022]

Response:Four

Clarification:

The Domain Name System (DNS) serves as a naming framework, linking the names individuals use to find websites to the corresponding IP addresses utilized by computers to locate those websites. This system interacts with either the Internet or a private network.

An IP address, represented as a 32-bit binary number, is typically presented in a standard format as 4 octets in decimal notation for easier human comprehension.

6 0
1 month ago
Someone else can drive your car if _____.
8_murik_8 [964]

Answer:

C. you possess insurance documentation

Explanation:

Being a resident does not automatically grant permission to operate a vehicle. For instance, a person might have residency but might also have a suspended license, which means they are unable to drive.

Typically, insurance applies to the CAR rather than the individual. Therefore, the general guideline is:

A different person is permitted to drive your vehicle if you possess proof of insurance.

6 0
1 month ago
Read 2 more answers
The budget process which emphasizes the achievement of goals and competition between alternatives is:
Rzqust [1037]

The question offers several choices;


<span>A) </span>Incremental budgeting.
B) Performance budgeting.
C) Program budgeting.
D) Target based budgeting.


I'd argue that D is the correct option; Target based budgeting.


Target based budgeting centers on achieving objectives and competing alternatives. This budgeting approach uses pricing as a strategic tool to influence sales outcomes. It involves market research to determine the precise selling price of a product.






4 0
1 month ago
Other questions:
  • Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image
    14·1 answer
  • Why computer is known as versatile and diligent device ?explain​
    14·1 answer
  • Which of the following type of online advertising intermediaries decide the placement and pricing of online display ads by using
    9·1 answer
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • Write a loop that reads strings from standard input, where the string is either duck or goose. the loop terminates when goose is
    7·1 answer
  • Here is a super challenge for you if you feel up for it. (You will need to work this out in Excel.) In 2017 the Islamic month of
    11·1 answer
  • Initialize the list short_names with strings 'Gus', 'Bob', and 'Zoe'. Sample output for the givenprogram:Gus Bob Zoeshort_names
    13·1 answer
  • What are the set of rules to move data from one computer to another?
    11·1 answer
  • Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand.
    9·1 answer
  • Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burn
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!