Question: Write a program that displays the following menu: 0. Fill array 1. Find high, low, sum average 2. Add a number to the end 3.




Write a program that displays the following menu: 0. Fill array 1. Find high, low, sum average 2. Add a number to the end 3. Find the index of a number 4. Insert number at index 5. Remove number at index 6. Remove number 7. Quit Functionality We suggest that you develop your program incrementally. Meaning one menu item at a time. If it works correctly, add another one and so on. In main() create an array of integers with size 10. Use a variable to store the number of filled elements (not all 10 elements will hold user data). No global variable may be declared/used. In main() declare int[] numbers = new int [10]; int elements = 0; 0. Fill array: Asks user how many numbers to fill (the length of the partially filled array). Validate the user entered a number (1-10). Fill the array with random numbers 0-99 inclusive. The number of elements should be equal to the value specified by the user. To handle this you will need to write method: int fillArray(int[] arr) Returns the number of elements specified by the user. 1. Calculates and prints the highest value, lowest, sum, and average of the partially filled array To handle this write a method with header. void findHighLow(int[] arr, int elements) 2. Add a number to the end asks user to enter a number and adds it to the end of the partially filled array. To handle this write a method with header: int addToEnd(int[] arr, int elements) Returns the number of elements currently in the array. If successful returns the number of elements + 1. If array is full, returns the number of elements unchanged. 3. Find index of a number: Displays the index of a number if it exists otherwise a message saying that the number is not found. To handle this write a method with header: void findNumber(int[] arr, int elements, int number).. Prints the index of the specified number. Or number not found if the number is not found. 4. Insert number at index: Ask the user to enter a number and the index to insert it in. Display error message if the array is full or if the specified index is invalid. So if we have say 5 elements a valid index would be (0-4). 5. Remove number at index: Ask the user to enter the index. Remove the number at the specified index or display error message if the specified index is invalid. So if we have say 5 elements a valid index would be (0-4). 6. Remove number: Ask the user to enter a number, remove it if it exists otherwise display a message to indicate that it does not exist. Example: 0. Fill array 1. Find high, low, sum average 2. Add a number to the end 3. Find the index of a number 4. Insert number at index 5. Remove number at index 6. Remove number 7. Quit 0 Enter how many numbers 1-10:5 12 24 45 67 78 O. Fill array 1. Find high, low, sum average 2. Add a number to the end 3. Find the index of a number 4. Insert number at index 5. Remove number at index 6. Remove number 7. Quit 2 Enter a number to add: 3 12 24 45 67 78 3 0. Fill array 1. Find high, low, sum average 2. Add a number to the end 3. Find the index of a number 4. Insert number at index 5. Remove number at index 6. Remove number.. 7. Quit 3 Enter the number to find: 14 14 does not exist 12 10 24 45 67 783 0. Fill array 1. Find high, low, sum average 1. Find high, low, sum average 2. Add a number to the end 3. Find the index of a number 4. Insert number at index 5. Remove number at index 6. Remove number 7. Quit 0 Enter how many numbers 1-10: 3 ****** $$*** Here is the ArrayMenu1.java please make it easy for me and I will give you a good rating. Thank you! import java.util.Scanner, import java.util. Random; public class ArrayMenu1 { public static void main() { int [] numbers = new int [10]; int elements = 0; int choice = 1; while (choice != 7) { showArray(numbers, elements); // prints the current numbers in the array choice = showMenu(); } System.out.println("Goodby!"); } public static void showArray(int[] array, int elements).. { for (int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
