Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program 1 - GradeBook class modifications Modify class GradeBook ( Fig 3.10 ) as

ID: 3656586 • Letter: P

Question

Program 1 - GradeBook class modifications Modify class GradeBook ( Fig 3.10 ) as follows: Here is a link to the source code for Figure 3-10 --> http://web.cerritos.edu/jwilson/SitePages/cis_182/assignments/figure_3-10.zip Include a second String instance variable (field) that represents the name of the instructor for the course. Provide a set method to change the instructor's name and a get method to retrieve it. Modify the constructor to specify two parameters - one for the course name and one for the course instructor. 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.

Explanation / Answer

public class GradeBook private String courseName; private String instructorName ; // constructor initializes courseName with String supplied as argument public GradeBook( String name, String instructor ) { courseName = name; // initializes courseName instructorName = instructor; } // end constructor // method to set the course name public void setCourseName( String name ) { courseName = name; // store the course name } // end method setCourseName // method to retrieve the course name public String getCourseName() { return courseName; } // end method getCourseName public void setInstructorName ( String instructor ) { instructorName = instructor; // store the instructor name } // end method setInstructorName // method to retrieve the instructor name public String getInstructorName() { return instructorName; } // end method getIntructorName //display a welcome message to the GradeBook User public void displayMessage() { // this statement calls getCourseName to get the // name of the course this GradeBook represents System.out.printf ( "Welcome to the Grade Book for %s! ", getCourseName()); } // end method displayMessage }//end class GradeBook public class GradeBookTest { // main method begins program execution public static void main ( String args[] ) { String courseName; String instructorName; Scanner input = new Scanner(System.in); GradeBook gradeBook1 = new GradeBook( courseName , instructorName ); GradeBook gradeBook2 = new GradeBook( courseName , instructorName ); // display initial value of courseName for each Gradebook System.out.printf ( "gradeBook1 course name is: %s ", gradeBook.getcourseName() ); System.out.printf ( "gradeBook2 course name is: %s ", gradeBook2.getcourseName() ); } // end main } // end class GradeBookTest

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote