In this lab you will create an integer array and will populate it via user interaction. Type up the program, execute it and submit the results only.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
User Interaction to Populate Array
In this lab you will create an integer array and will populate it via user interaction. Type
up the program, execute it and submit the results only.
1 import java.util.Scanner; // Import the Scanner class
2
3 public class ArrayEnterValues (
59 public static void main(String[] args) {
int[] myIntArr new int[5];
Scanner scan = new Scanner(System.in);
for (int x = 0; x < 5; x++)
{
8
9
SENANA90298507
10
11
12
13
14
15
16
17
18
19
21
22
23 >
}
}
System.out.println("Enter the value for for index
myIntArr[x] = scan.nextInt();
System.out.println("The values in my array are: ");
for (int y = 0; y < 5; y++)
(
System.out.println("Index: "+y+"\tValue: " + myIntArr[y]);
}
Transcribed Image Text:User Interaction to Populate Array In this lab you will create an integer array and will populate it via user interaction. Type up the program, execute it and submit the results only. 1 import java.util.Scanner; // Import the Scanner class 2 3 public class ArrayEnterValues ( 59 public static void main(String[] args) { int[] myIntArr new int[5]; Scanner scan = new Scanner(System.in); for (int x = 0; x < 5; x++) { 8 9 SENANA90298507 10 11 12 13 14 15 16 17 18 19 21 22 23 > } } System.out.println("Enter the value for for index myIntArr[x] = scan.nextInt(); System.out.println("The values in my array are: "); for (int y = 0; y < 5; y++) ( System.out.println("Index: "+y+"\tValue: " + myIntArr[y]); }
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,