
-----------------------------------
Caceres
Sun Jul 23, 2006 9:57 pm

Little qick question.
-----------------------------------
Hey, I've bene working on this program for HOURS! I'm a noob so it take sme forever. :P
Anyways.. I just ran into a very minor error.
I do a statement to find the minimum value, but the termaining code is "-1". So it always returns the -1 as the minimum value.

My whole program is as follows:
import TerminalIO.KeyboardReader;
import becker.io.*;
import java.io.*;

public class ass52 {
   public static void main(String[] args) {
      KeyboardReader reader = new KeyboardReader();
      double[] number = new double[21];
      double sum = 0; 
      int count = 0; 
      double average = 0; 
      double maximum=number[0]; 
      double minimum=number[0];  

      System.out.println("\nType -1 when you're finished entering your marks.");
      System.out.println("\nEnter up to 20 marks and the program will calculate the average.");

      while(number[count]!=-1&&count!=20) { 	      
	      count=count+1;
	      System.out.print("Enter mark " + (count) + ": ");	            
         	number[count] = reader.readDouble();         
         if(number[count]!=-1)
         	sum = sum + number[count];
        
        if(number[count] > maximum) {
	        maximum=number[count];
        }
        
        
        if(number[count] < minimum) {
	        minimum=number[count];
        }
                   	        
   } 
        if(count==20)
        	average=sum/count;
        else if(count maximum) {
            maximum = number[count];
         }
       
         if (number[count] < minimum) {
            minimum=number[count];
         }                           
      }
  
      if (count == 20) {
         average = sum / count;
      } else if (count 