title: Diving score array program
body: <p>I have a dive scoring program.  However, I am having difficulty getting the lowest score and handling the input after an error has been made.  Could someone advise?  Thank you for any help you could give.
       Yours truly,
       Quang Pham</p>
  
  <pre><code> Is there code to get the lowest and highest scores?  How come I get 0 for the lowest score instead of 5?  Also, after an error is made, can the user reenter a different score and get the correct answer?   divingScores[i - 1] = divingScores[i];  Is there a way to go back on an array and enter another value?  The dive scoring program takes the evaluative scores of seven judges and arrives at a final score for a dive. Any help is most greatly appreciated.
  </code></pre>
  
  <p>Problem Description:
       *<br>
       *        In the sport of diving, seven judges award a score between 0 and 10,
       *   where each score may be a floating-point value.  The highest and lowest 
       *   scores are thrown out and the remaining scores are added together.  The 
       *   sum is then multiplied by the degree of difficulty for that dive.  (The 
       *   degree of difficulty ranges from 1.2 to 3.8 points.)  The total is then 
       *   multiplied by 0.6 to determine the diver’s score.
       *        Write a program that asks a user to enter a dive's degree of difficulty
       *   and seven judges’ scores, then displays the overall score for that dive.
       *   The program should ensure that all inputs are within the allowable data 
       *   ranges.
       *        The judges scores should be stored in array.
       *        Please perform error checking on all user entries (degree of 
       *   difficulty and each judge's score), verifying that the entry from the
       *   user is between a minimum and maximum values.
       *        A sample dialog is given below:
       *
       *       ** Diving Score Calculator **
       *
       *   Enter the score from Judge #1 (0 – 10): 5
       *   Enter the score from Judge #2 (0 – 10): 8.5
       *   Enter the score from Judge #3 (0 – 10): 7
       *   Enter the score from Judge #4 (0 – 10): 11
       *       ** Please enter a number from 0 to 10. 
       *   Enter the score from Judge #4 (0 – 10): 10
       *   Enter the score from Judge #5 (0 – 10): 9.9
       *   Enter the score from Judge #6 (0 – 10): 8.1
       *   Enter the score from Judge #7 (0 – 10): 6.3
       *   Enter the degree of difficulty (1.2 – 3.8): 4
       *       ** Please enter a number from 1.2 to 3.8).
       *   Enter the degree of difficulty (1.2 – 3.8): 3.3<br>
       *
       *   The total of all scores:  54.8
       *   Minus high and low:       39.8
       *   Final Score:              78.80
       *</p>
  
  <pre><code>import java.util.Scanner ;
  /**
   * The dive scoring program takes the evaluative scores of seven judges and 
   * arrives at a final score for a dive.
   *
   * @author Quang Pham
   * @version Module8, Homework Project 1, 4/1/20
   * 
   *    Algorithm:
   *    
   *    1. Seven judge's scores are entered into an array.
   *    2. The scores are checked to see if they are between the minimum and
   *       maximum values.
   *    3. The total of all the scores, the degree of difficulty, the scores 
   *       minus the high and low scores, and the final score are outputted.
   *    
   *    
   *    Problem Description:
   *    
   *        In the sport of diving, seven judges award a score between 0 and 10,
   *   where each score may be a floating-point value.  The highest and lowest 
   *   scores are thrown out and the remaining scores are added together.  The 
   *   sum is then multiplied by the degree of difficulty for that dive.  (The 
   *   degree of difficulty ranges from 1.2 to 3.8 points.)  The total is then 
   *   multiplied by 0.6 to determine the diver’s score.
   *        Write a program that asks a user to enter a dive's degree of difficulty
   *   and seven judges’ scores, then displays the overall score for that dive.
   *   The program should ensure that all inputs are within the allowable data 
   *   ranges.
   *        The judges scores should be stored in array.
   *        Please perform error checking on all user entries (degree of 
   *   difficulty and each judge's score), verifying that the entry from the
   *   user is between a minimum and maximum values.
   *        A sample dialog is given below:
   *
   *       ** Diving Score Calculator **
   *
   *   Enter the score from Judge #1 (0 – 10): 5
   *   Enter the score from Judge #2 (0 – 10): 8.5
   *   Enter the score from Judge #3 (0 – 10): 7
   *   Enter the score from Judge #4 (0 – 10): 11
   *       ** Please enter a number from 0 to 10. 
   *   Enter the score from Judge #4 (0 – 10): 10
   *   Enter the score from Judge #5 (0 – 10): 9.9
   *   Enter the score from Judge #6 (0 – 10): 8.1
   *   Enter the score from Judge #7 (0 – 10): 6.3
   *   Enter the degree of difficulty (1.2 – 3.8): 4
   *       ** Please enter a number from 1.2 to 3.8).
   *   Enter the degree of difficulty (1.2 – 3.8): 3.3  
   *
   *   The total of all scores:  54.8
   *   Minus high and low:       39.8
   *   Final Score:              78.80
   *
   *        Format your final score to 2 digits.  You may write this assignment
   *   as a single class, where you use helper (private) methods to main instead 
   *   of putting them in a separate class.
   *        Test your program with several different input dives and print
   *   screen or screen snip of the results.
   *    
   */
  public class DiveScoringProgram {
      public static void main(String[] args) {
  
          Scanner keyboard = new Scanner(System.in);
  
          double divingScores[] = new double[7] ;
          double input ;
          double difficultyInput = 0 ;
          double high = 0 ;
          double low = 0 ;
          double totalAllScores = 0 ;
          double totalMinusHighLow = 0 ;
          double totalFinalScore = 0 ;
          double Arrays = 0 ;
  
          for (int i = 0; i &lt; divingScores.length; i++) 
          {
              System.out.println("Enter the score from Judge #" + (i + 1) + " (0-10):  ") ;
              input = keyboard.nextDouble();
  
              if(input &lt; 0 || input &gt; 10) 
              {
                  System.out.println("Invalid score.  Please enter a number from 0 to 10") ;
                  divingScores[i - 1] = divingScores[i];
                  input = keyboard.nextDouble() ;
              }
              else 
              {
                  totalAllScores += input ; 
                  divingScores[i] = input;
              } 
          }
  
          while (difficultyInput &lt; 1.2 || difficultyInput &gt; 3.8) 
          {
              System.out.println("Enter the degree of difficulty (1.2- 3.8):  ") ;
              difficultyInput = keyboard.nextDouble() ;
              if (difficultyInput &lt; 1.2 || difficultyInput &gt; 3.8)
              {
                  System.out.println("Invalid difficulty input.  Please enter a number from 1.2 to 3.8.") ;
                  difficultyInput = keyboard.nextDouble() ;
              }
          }
          //determine high and low values 
          for(int i = 0; i &lt; divingScores.length; i++)
          {
              if(divingScores[i] &gt; high)
              {high = divingScores[i];}
              if(divingScores[i] &lt; low)
              {low = divingScores[i];}
          }
  
          System.out.println("low is " + low) ;
          System.out.println("high is " + high) ;
  
          totalMinusHighLow = totalAllScores - high - low ;
          totalFinalScore = totalMinusHighLow * difficultyInput * 0.6 ;
  
          System.out.println("The total of all scores:  " + totalAllScores) ;
          System.out.println("Minus high and low:  " + totalMinusHighLow) ;
          System.out.printf("The overall final score for the dive: %.2f\n", totalFinalScore);
  
      } //end main
  } //end class
  </code></pre>