So my code is just about finished for a project I have due tomorrow. However there's one part that's still preventing the code from being compiled completely. Here's the error it returns.
Paniagua_ArrayProcessing.java:108: ';' expected public static void evenOdd(int[] array) throwsIOException{ ^ 1 error
And here's the full code. I've looked it over for semicolons and brackets but nothing appears to be wrong. I don't know what I could or should do. Any help is appreciated. Thanks!
import java.io.*; import java.util.Scanner; public class Paniagua_ArrayProcessing{ //The main method: arranges all operations. public static void main(String[] args) throws IOException{ int[] numbers = inputData(); printArray(numbers); reverseArray(numbers); int arraySum = sum(numbers); System.out.println("The sum of all elements is: " + arraySum); double arrayMean = mean(numbers); System.out.printf("The mean of all elements is: %.2f\n", arrayMean); int arrayMin = min(numbers); System.out.println("The min of all the elements is: " + arrayMin); int arrayMax = max(numbers); System.out.println("The max of all the elements is: " + arrayMax); evenOdd(numbers); System.out.println("Program completed. Data written to the files."); } //inputData method: gathers data and creates array. public static int[] inputData() throws IOException{ Scanner keyboard = new Scanner(System.in); String input; int lines; System.out.println("Please enter a file name: "); input = keyboard.nextLine(); File myfile = new File(input); if (!myfile.exists()){ System.out.println("File not found."); System.exit(1); } Scanner inputFile = new Scanner(myfile); lines = inputFile.nextInt(); int[] numbers = new int[lines]; for (int i=0; i<lines; i++){ if (inputFile.hasNextInt()){ int moreLines = inputFile.nextInt(); numbers[i] = moreLines; } } inputFile.close(); return numbers; } //printArray method: prints arrays. public static void printArray(int[] array){ System.out.println("Printing array: "); for (int i = 1; i<array.length+1; i++){ System.out.printf("%7d", array[i-1]); if (i%10==0){ System.out.println(); } } System.out.println(); } //reverseArray method: prints reversed arrays. public static void reverseArray(int[] array){ System.out.println("Printing reversed array: "); int a=0; for (int i = array.length-1; i>=0; i--){ System.out.printf("%7d", array[i]); a++; if (a%10==0){ System.out.println(); } } System.out.println("\n"); } //sum method: adds all elements of an array. public static int sum(int[] array){ int total = 0; for (int i = 0; i < array.length; i++){ total += array[i]; } return total; } //mean method: This method hurts everyone. JK, it calculates the average of an array. public static double mean(int[] array){ double total = 0; double average; for (int i = 0; i < array.length; i++) total += array[i]; average = total / array.length; return average; } //min method: calculates the lowest number in an array. public static int min(int[] array){ int lowest = array[0]; for (int i = 1; i < array.length; i++){ if (array[i] < lowest){ lowest = array[i]; } } return lowest; } //max method: calculates the highest number in an array. public static int max(int[] array){ int highest = array[0]; for (int i = 1; i < array.length; i++){ if (array[i] > highest){ highest = array[i]; } } return highest; } // evenOdd method: writes odd or even numbers to their files respectively. public static void evenOdd(int[] array) throwsIOException{ PrintWriter outputFileEven = new PrintWriter("even.out.txt"); PrintWriter outputFileOdd = new PrintWriter("odd.out.txt"); for (int i = 0; i<array.length; i++){ if (array[i] % 2 ==0){ outputFileEven.println(); } else{ outputFileOdd.println(); } } outputFileEven.close(); outputFileOdd.close(); } }