Respuesta :
import java.util.Scanner; public class StoreGuesses { public static void main (String [] args) {
public static void main (String [] args) { Scanner scnr = new Scanner(System.in);
Scanner scnr = new Scanner(System.in); final int NUM_GUESSES = 3;
final int NUM_GUESSES = 3; int[] userGuesses = new int[NUM_GUESSES];
int[] userGuesses = new int[NUM_GUESSES]; int i = 0;
int i = 0; for (i = 0; i < NUM_GUESSES; ++i) {
userGuesses[i] = scnr.nextInt();
}
for (i = 0; i < NUM_GUESSES; ++i){ System.out.print(userGuesses[i] + " ");
System.out.print(userGuesses[i] + " "); }
} return; }
}}
}
public static void main (String [] args) { Scanner scnr = new Scanner(System.in);
Scanner scnr = new Scanner(System.in); final int NUM_GUESSES = 3;
final int NUM_GUESSES = 3; int[] userGuesses = new int[NUM_GUESSES];
int[] userGuesses = new int[NUM_GUESSES]; int i = 0;
int i = 0; for (i = 0; i < NUM_GUESSES; ++i) {
userGuesses[i] = scnr.nextInt();
}
for (i = 0; i < NUM_GUESSES; ++i){ System.out.print(userGuesses[i] + " ");
System.out.print(userGuesses[i] + " "); }
} return; }
}}
}
Answer:
For displaying the number guesses in array user guess, first declare the number guess variable and set it to 3. After this, store the number guesses in array user guesses variables. Then declare the for loop and run till the number of guesses. Finally, print the number of guesses using print statement.
Further explanation:
Following is the JAVA program to populate the array user guesses with number guesses integers.
Code:
import java.util.Scanner;
//class definition
public class NumberGuesses
{
public static void main (String [] args)
{
Scanner scnr = new Scanner(System.in);
//initialize the variable number guesses with 3
final int num_guesses=3;
//store the number guesses variable in an array
int[] user_guesses = new int[num_guesses];
int i = 0;
//for loop declaration
for (i = 0; i < num_guesses; ++i)
{
user_guesses[i] = scnr.nextInt();
}
for (i = 0; i < num_guesses; ++i)
{
//print the output
System.out.print(user_guesses[i] + " ");
}
}
return;
}
Learn more:
1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011
2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832
3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623
4. List 3 characteristics of the ideal encryption scheme. brainly.com/question/3000161
Answer details:
Grade: College Engineering
Subject: Computer Science and Engineering
Chapter: JAVA Programming
Keyword:
C Language, C++ language, JAVA, python, for loop, populate, array, read, scanner, class, num_guesses, user_guesses, enters, 9, 5, 2, variable, function, print, condition, true, false, return, system.out.print