Program 1 - GradeBook class modifications Modify class GradeBook.docx

This preview shows page 1 - 4 out of 4 pages.

Program 1 - GradeBook class modifications Modify class GradeBook ( Fig 3.10 ) as follows: 1. Include a second String instance variable (field) that represents the name of the course's instructor. 2. Provide a set method to change the instructor's name and a get method to retrieve it. 3. Modify the constructor to specify two parameters - one for the course name and one for the instructor's name.
4. Modify method displayMessage such that it first outputs the welcome message and course name, then outputs "This course is presented by: " followed by the instructor's name. Use your modified class in a test application that demonstrates the class's new capabilities. GradeBook public class GradeBook { private String courseName; // course name for this GradeBook // constructor initializes courseName with String supplied as argument public GradeBook( String name ) {
courseName = name; // initializes courseName } // end constructor // method to set the course name public void setCourseName( String name ) { courseName = name; // store the course name } // end method setCourseName

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture