Question: Task 2: Have the user store values in an array. 2a. Comment out all code from task 1. 2b. In the same Java project, begin

Task 2:

Have the user store values in an array.

2a. Comment out all code from task 1.

2b. In the same Java project, begin by asking the user

how many values

they would like to store into an array.

2c. Initialize a global String array "data" using the

input as size.

2d. Create a method called "populateArray" which will

contain a loop

that asks the user to input each value and

store them within the

global array "data".

2e. Use a loop to print the contents of the changed

array.

Task 3:

Have the user access or modify a value in the array.

3a. Create a method called "changeArray" which will ask

the user for an

index (location) in the array.

3b. Print out the value stored in the global array at the

index

specified by the user .

3c. Ask the user if they would like to change that value.

If so, get a

value from the user and modify "data" at the

specified index to

match the user's input.

3d. Use a loop to print the contents of the changed

array.

Annotations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!