Question: Java Arrays Lab: I am having an issue in Java setting a parameter in a method when i try to call it. The called method

Java Arrays Lab:

I am having an issue in Java setting a parameter in a method when i try to call it. The called method has an integer and an array but the array portion ive named "numbers" has a syntax error. The prompt for the lab is below, I have only completed 2 parts of the menu so far.

Question: Write a program that prompts the user for 10 integer values (positive or negative). Place these 10 values into an array. Display a repeating menu to the user that will let them choose from several different functions that operate on the values they just inputted. Create the following functions: 1. Populate Array construct the array, prompt the user for 10 integers and place each item in the array in that order, return the array. 2. Display Values pass in the array, print the contents of the array on a single line, separated by commas. 3. Display Reversed pass in the array, print the contents of the array in reverse order separated by commas (do not change the order of the array). 4. Find Value pass in the array and the value to be found. Search for that value in the array and return the index location. If the value is not in the array, return -1. 5. Insert Value pass in the array, the location, and the new value. Overwrite the old value at that location with the new one. 6. Maximum Value iterate through the array and return the largest value. 7. Compute Sum add up all of the values in the array and return the sum. 8. Display Menu Displays the menu below to the user. Menu Repeat the menu until the user quits. 1. Display Values 2. Display Reversed 3. Display Sum 4. Display Maximum 5. Search for a Value 6. Insert new Value 7. Reset Values 8. Quit

My code so far:

Java Arrays Lab: I am having an issue in Java setting a

parameter in a method when i try to call it. The called

Any help would be appreciated :)

4 import java.util.scanner; 6 public class Arrays boolean exit; public static void main(String[] args) Arrays menunew Arrays ); menu.enterNumbers O menu.runMenu) 14 15 public void enterNumbers) 16 17 Scanner in-new Scanner(System.in); System.out.println("Enter 10 numbers: "); int[] numbers new int[10]. // created array 2 for(int # 0; i 2) { 42 45 try f System.out.print( InEnter your choice: ") choice = Integer.parseInt(gi.nextLine()); 49 catch(NumberFormatException e) { System.out.printin("Invalid selection. Please try again." 5.1 gi.close) return choice; 56

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!