Source of GradeBookTest.java


  1: // Fig. 3.5: GradeBookTest.java
  2: // Create GradeBook object and pass a String to 
  3: // its displayMessage method.
  4: import java.util.Scanner; // program uses Scanner
  5: 
  6: public class GradeBookTest
  7: {
  8:    // main method begins program execution
  9:    public static void main( String args[] )
 10:    { 
 11:       // create Scanner to obtain input from command window
 12:       Scanner input = new Scanner( System.in );
 13: 
 14:       // create a GradeBook object and assign it to myGradeBook
 15:       GradeBook myGradeBook = new GradeBook(); 
 16: 
 17:       // prompt for and input course name
 18:       System.out.println( "Please enter the course name:" );
 19:       String courseName = input.nextLine(); // read a line of text
 20:       System.out.println(); // outputs a blank line
 21: 
 22:       // call myGradeBook's displayMessage method 
 23:       // and pass courseName as an argument
 24:       myGradeBook.displayMessage( courseName );
 25:    } // end main
 26: 
 27: } // end class GradeBookTest
 28: 
 29: 
 30: /**************************************************************************
 31:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 32:  * Pearson Education, Inc. All Rights Reserved.                           *
 33:  *                                                                        *
 34:  * DISCLAIMER: The authors and publisher of this book have used their     *
 35:  * best efforts in preparing the book. These efforts include the          *
 36:  * development, research, and testing of the theories and programs        *
 37:  * to determine their effectiveness. The authors and publisher make       *
 38:  * no warranty of any kind, expressed or implied, with regard to these    *
 39:  * programs or to the documentation contained in these books. The authors *
 40:  * and publisher shall not be liable in any event for incidental or       *
 41:  * consequential damages in connection with, or arising out of, the       *
 42:  * furnishing, performance, or use of these programs.                     *
 43:  *************************************************************************/