thanks for the help as always. I'm stuck on this problem and i don't know why this isn't working. This is my first time using array's so that's probably why i don't know what i am doing but here it is..
The problem lies when calling the getHighest and getLowest method. The error i get is..
The method getHighest(double[]) in the type RainfallClass is not applicable for the arguments ()
Also note i'm not supposed to use any other classes just methods.
import java.util.Scanner; import java.text.DecimalFormat; public class RainfallClass { public static void main(String[] args) { DecimalFormat fmt = new DecimalFormat("0.00"); //call the getTotal method double tot = getTotal(); //call and pass the average method double average = getAverage(tot); //Call and pass the highest method double highest = getHighest(); //Call and pass the lowest method double lowest = getLowest(); //Display output System.out.println("Total\t\tAverage\t\tHighest\t\tLowest"); System.out.println(".........................................................."); System.out.println(fmt.format(tot) + " inches \t" + fmt.format(average) + " inches \t" + fmt.format(highest) + " inches\t" + fmt.format(lowest) + " inches"); } public static double getTotal() { double total = 0.0; double[] inches = new double[12]; String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; Scanner keyboard = new Scanner(System.in); for (int i = 0; i < inches.length; i++) { System.out.println("Enter the total rainfall for " + months); inches = keyboard.nextDouble(); keyboard.nextLine(); while (inches < 0) { System.out.println("Entry must be a postive number"); System.out.println("Enter the total rainfall for " + months); inches = keyboard.nextDouble(); keyboard.nextLine(); } total += inches; } getHighest(inches); getLowest(inches); return total; } public static double getAverage(double a) { double average = a / 12; return average; } public static double getHighest(double[] h) { double highest = h[0]; for (int j = 0; j < h.length; j++) { if (h[j] > highest) highest = h[j]; } return highest; } public static double getLowest(double[] l) { double lowest = l[0]; for (int j = 0; j < l.length; j++) { if (l[j] < lowest) lowest = l[j]; } return lowest; } }