arrays - Java - Highest, Lowest and Average -


OK, so why does Java come with this error:

Thread "Main" in Java Exception .lang.Error: unchanged compilation problem: type mismatch: double to int

can not be converted into rain. (Rain.java38)

From:

  Public square rain {/ ** * @ ultimate arguments * / public static zero main (string [] args) {int [] Numgroup; NewGroup = New Int [12]; Console Reader Console = New Console Reader (); Int supreme; Minimal info; Int index Int tempVal; Int Minnom; Int Min Indak; Int maxMonth; Int max index; System.out.println ("Welcome to Rain"); // index (Index now 0-based) (index = 0; index and lieutenant; 12; index = index + 1) {System.out.println ("Please enter rain for the month" + 1 + index) ; TempVal = console.readInt (); While (tempVal & gt; 100} tempVal & lt; 0) {System.out.println ("The rating should be within 0 ... 100. Retry"); TempVal = console.readInt (); } Mail Group [index] = Tempele; } Low = number group [0]; Highest = mail group [0]; Integer = 0.0; // loop on data for index = index = 1 (index = 0; index = index 1) (using 1 loop) {int curr = numgroup [index]; If (curr & lt; lowest) {min = curr; Min indax = index; } If (curr> highest) {supreme = curr; Max index = index; } Total + =; } Float average = (float) total / numgroup.length; System.out.println ("average monthly rainfall" + average +) was; System.out.println ("Minimum Monthly Rain Months" + Mini Index + 1) to go from 1 +1 0-based index to 1-month month; System.out.println ("The most monthly rainiest months" + maxindex + 1); System.out.println ("Thanks for using Rain"); } Private Static Console Reader Console Reader () {return tap; }}  

I think the culprit is this line:

  integer = 0.0;  

must be

  integer = 0; Instead  

.


Comments