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
bogdanovich [222]
2 years ago
13

Write a for loop to populate array userGuesses with NUM GUESSES integers. Read integers using Scanner. Ex If NUM GUESSES is 3 an

d user enters 9 5 2, then userGuesses is 19, 5, 2) 1 import java til. Sca nner 3 public class Store Guesses 4 public static void main (string args) Scanner SCnr new Scanner (System in final int NUM GUESSES int[] user Guesses new int[NUM. GUESSES] int 0; Your solution goes here 10 for (i 03 i NUM GUESSES ++i){ 11 user Guesses [i] scnr.nextInt 12 13 14 15 for (i 0; i NUM GUESSES ++i) 16 System.out print (u 17 18 19 for (i 0; i NUM GUESSES ++i)t 20 System Ou print (userGuesses[i] 21 Run X Testing for 12, 4, 6) 2 4 6 Expected output Your output 2 4 6 2 4 6 Tests aborted
Computers and Technology
1 answer:
inn [45]2 years ago
7 0

Answer:  

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];  

      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] + " ");  

      }  

  }  

}  

/*

Output:

2 4 6  

2 4 6  

*/

You might be interested in
Using MARS/MIPS
slega [8]

Answer:

Explanation:

MIPS program which increments from 0 to 15 and display results in Decimal on the console

In this program the user defined procedures print_int and print_eot were used to print the integer values and new line characters(\n) respectively.the mechanisam of the loop is explaine in the comment section of the program.

     addi $s0, $0, 0

     addi $s1, $0, 15

print_int:

              li $v0, 1                # system call to print integer

              syscall                

              jr $ra                     # return

print_eol:                      # prints "\n"

            li $v0, 4            

              la $a0, linebrk      

              syscall              

              jr $ra                  # return

main: . . .          

              li $a0, 0                # print 0

              jal print_int         # print value in $a0

loop:   move $a0, $s0           # print loop count

       jal print_int        

       jal print_eol           # print "\n" character

       addi $s0, $s0, 1        # increment loop count by 1

       ble $s1, $s0, loop      # exit if $s1<$s0

beq $s0, $0, end

end:

MIPS progam to increment from 0 to 15 and display results in Hexadecimal on the console

this program is slightly differed from the previous program in this program the system call issued in print_int is implemented with a system call that prints numbers in hex.

addi $s0, $0, 15

     addi $s1, $0, 0

print_int:

   li      $v0,34                  # syscall number for "print hex"

   syscall                         # issue the syscall

              jr $ra                     # return

print_eol:                      # prints "\n"

            li $v0, 4            

              la $a0, linebrk      

              syscall              

              jr $ra                  # return

main: . . .          

              li $a0, 0                # print 0

              jal print_int         # print value in $a0

loop:   move $a0, $s0           # print loop count

       jal print_int        

       jal print_eol           # print "\n" character

       addi $s0, $s0, 1        # increment loop count by 1

       ble $s1, $s0, loop      # exit if $s0>$s1

beq $s0, $0, end

end:

5 0
3 years ago
1. Target area range is a survey of what lies about __________ seconds ahead of the vehicle. A. 5-10 B. 10-20 C. 20-30 D. 40-50
pshichka [43]

Answer:

Target area range is a survey of what lies about 12-20 seconds ahead of the vehicle. Correct Answer is B. (10-20 second)

Explanation:

Target area range is the space between your vehicle and the target area. A target area is an area on the roadway where the target is located. A target can be anything such as a car, a traffic signal, a blackhead, etc.

Target area range is also a section of roadway where the target is located and the area to the left and right of the target area

4 0
3 years ago
Read 2 more answers
The picture has the question on it
Bingel [31]

The answer is B. Row

4 0
2 years ago
The kitchen in any café is a noisy place. To make sure the orders which you have carefully written down on your notepad make it
Levart [38]

Answer:

file_name = 'orders.txt'

file_obj = open( file_name, 'r' )

lines = file_obj.read()

print(lines.upper(), end = '')

Explanation:

  • Define the name of the file .
  • Use the built-in open function to open the file in read mode .
  • Use the built-in read function to read the file and assign this to lines variable.
  • Finally display the lines by converting them to capital alphabets by using the built-in upper() function.
5 0
3 years ago
Commercials are short media advertising that persuades a consumer to buy/use their product/service?
ioda

Answer:

true

Explanation:

thats what they are

6 0
3 years ago
Read 2 more answers
Other questions:
  • Which transfer of learning occurs when the performance of a maneuver interferes with the learning of another maneuver?
    6·1 answer
  • From the standpoint of the governing bodies of .com, why is it important that owners of individual domains maintain authoritativ
    5·1 answer
  • What command displays a computer s network settings?
    5·1 answer
  • Sally needs to copy data from the first worksheet to the fifth worksheet in her workbook. Which combination of keys will she use
    6·2 answers
  • Part of preforming routine computer maintenance includes
    9·2 answers
  • What is one purpose of an algorithm
    14·1 answer
  • Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac
    5·1 answer
  • Computer network reduces the cost of operation​
    14·1 answer
  • Charles was supposed to present his PowerPoint slides to his classmates in a classroom, but now he has to present in the auditor
    12·2 answers
  • I am trying to make a flowgorithm chart for a dogs name, age, weight and when their weight is less than 50 OR more than 100 its
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!