Hello, I'm trying to do a program that asks the user to input double values and display the values, along with the sum, average, largest and smallest. The limit of inputs is 15. I have to clear the instance variables at the end. The notes in what I have so far should explain the rest. Any help would be appreciated. Please and thank you
import java.util.Scanner; public class cheese_ArrayList { Scanner input = new Scanner(System.in); private double sum, average, large, small; //private double[] list; public void cheese_ArrayList() //tell array to hold up to ARRAY_MAX values { final int MAX_ARRAY; //store max number of allowed inputs double[] list = new double[ MAX_ARRAY ]; //store double values input by user while(MAX_ARRAY < 1 || MAX_ARRAY > 15) { System.out.print("How many values do you want to input?"); MAX_ARRAY = input.nextInt(); if(MAX_ARRAY < 1 || MAX_ARRAY > 15) System.out.println("Please enter a number between 1 and 15 inclusively"); } getData(); processData(); displayData(); clearData(); } public void getData() //repetition structure to read up to ARRAY_MAX values { //number of inputs recorded //limit user to a max of 15 inputs //store actual number of input in count for(int count = 0; count < list.length; count++) { System.out.print("Enter a double value: "); double[] list = input.nextDouble(); // System.out.print("Would you like to enter another value (Y or N)?"); // char answer = input.nextChar(); // if(answer == "n" || answer == "N") } } public double processData() //calculate sum, average, large, small and store in list { double sum, average, large, small; for(int count = 0; count < list.length; count++) sum += list[ count ]; for(int count = 0; count < list.length; count++) average = list[ count ] / count; for(int count = 0; count < list.length; count++) if(large < list[ count ]) { large = list[ count ]; large = count; } for(int count = 0; count < list.length; count++) if(small > list[ count ]) { small = list[ count ]; small = count; } } public void displayData() //repetition structure show values in list (array) { System.out.printf("%s%d%s%.6d", "Value ", count, "= ", list[ count ]); System.out.printf("\nSum of all values = %d", sum); System.out.printf("\nAverage of all values = %d", average); System.out.printf("\nLargest value = %d", large); System.out.printf("\nSmallest value = %d", small); } public void clearData() //set all instance variable values back to zero { list[ count ] = 0; count = 0; System.out.println("The list is now cleared."); } }