TestPlan1.java
//********************************************************************
//
// TestPlan1.java
// Program description: A program for learning about Test Plans
//
//********************************************************************
//
// Program Description:
// --------------------
//      Converts from number score to a letter grade.
//
// Input Requirements:
// -------------------
//      1. score: an integer in the range 0 to 100 (inclusive)
//      2. user reply: a String, "yes" or "no"
//
// Output Requirements:
// --------------------
//      Prompt messages:
//        1. prompt for score
//        2. prompt if user wants to convert another score
//      Output results:
//        "Letter grade is X", where X = A, B, C, D, or F
//
// Program Preconditions:
// ----------------------
//      None.
//      (This means that this program will produce the correct outputs
//      regardless of what the inputs are.  There are no restrictions
//      about possible improper inputs.  See if you "break this program"
//      by inputting an invalid input.  Bet you can't.)
//
// Problem Solution Discussion:
// ----------------------------
//     This program prompts the user to enter an integer score in the range 0-100
//     (inclusive).  It then uses a series of selection statements to determine
//     the equivalent letter grade: >= 90 -> A, 80-89 -> B, 70-79 -> C, 60-69 -> D,
//     and < 60 -> F, and prints of the letter grade.
//
//     Two loops are used.  The main loop continues while the user answers the
//     question "Do you want to convert another score" with the answer "yes".
//     A second loop is continued as long as the user has entered an invalid score
//     (outside the range 0-100).
//   
//
// Problem Solution Design Steps:
// ------------------------------
//
//      Data structures:
//      ----------------
//
//      score:            integer
//      letterGrade:      character
//      convertAnother:   String
//
//      Algorithm:
//      ----------
//
//      1. Initialize convertAnother string to "yes"
//      2. Loop while convertAnother equals "yes"
//         A. Prompt user to enter a score
//         B. Input value: score
//         C. Loop while score is invalid (not in 0-100 range)
//            1. Print error message with score value
//            2. Prompt user to enter a score
//            3. Input value: score
//         D. if score >= 90
//	      Set letterGrade = A
//         E. if 90 > score >= 80
//	      Set letterGrade = B
//         F. if 80 > score >= 70
//	      Set letterGrade = C
//         G. if 70 > score >= 60
//	      Set letterGrade = D
//         H. if score < 60
//	      Set letterGrade = F
//         I. Print letterGrade
//         J. Prompt user for continue.  Enter "yes" or "no"
//         K. Input: convertAnother
//
// Test Plan
// ---------
//
//
// Test Case Description     Input Data    Expected Results
// ---------------------     ----------    ----------------
// 1. score >= 90                90        Prints: Letter grade is A
// 2. 90 > score >= 80           85        Prints: Letter grade is B
// 3. 70 > score >= 60           60        Prints: Letter grade is D
// 4. score < 60                 59        Prints: Letter grade is F
//  
// This Test Plan should include a test path for the result of "C"
//********************************************************************

import cs1.Keyboard;

public class TestPlan1
{
   //-----------------------------------------------------------------
   //  Comment
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
    int score;                                      // test score
    char letterGrade;                               // score converted to letter
    String convertAnother = new String("yes");      // user reply string

    // Loop until user enter answer that is not "yes"
    while ( convertAnother.equals("yes") )
    {
        // Prompt user and read the input
        System.out.print( "Enter a score (integer between 0 and 100): " );
        score = Keyboard.readInt();

	// Check for valid input data.  Loop and repeat prompt and input until valid.
        while ( score < 0 || score > 100 )
        {
            System.out.println( score + " is an invalid value." );
            System.out.print( "Enter a score (integer between 0 and 100): " );
            score = Keyboard.readInt();
        }

            // Perform tests to determine letter grade
/* 1 */     if ( score >= 90 )
/* 2 */         letterGrade = 'A';
/* 3 */     else if ( score >= 80 )
/* 4 */         letterGrade = 'B';
/* 5 */     else if ( score >= 70 )
/* 6 */         letterGrade = 'B';
/* 7 */     else if ( score >= 60 )//equal sign added to run properly
/* 8 */         letterGrade = 'D';
/* 9 */     else
/* 10 */        letterGrade = 'F';

        // Print letter grade
        System.out.println( "Letter grade is " + letterGrade + "." );

        // Prompt for continue
        System.out.print( "Do you wish to convert another score? " );
        convertAnother = Keyboard.readString();
    }
   } // end main

} // end class TestPlan1