Monday, July 27, 2009

Another java help...?

Modify class GradeBook as follows:


a) include a second String instance variable that represents the name of the course's


instructor.


b) provide a set method to change the instructor's name and a get method to retrieve it.


c) modify the constructor to specify two parameters -- one for the course name ang one


for the instructor's name.


d) modify method displayMessage such that it first outputs the welcome message and couse


name, then outputs "This course is presented by:" followed by the instructor's name.

Another java help...?
First off, you should have given the class GradeBook as it already exists.





However, I will create GradeBook class with all of the listed requirements, and hope you can piece the two together.





public class GradeBook


{


private String instructorName;


private String courseName;





public void GradeBook(String courseN, String instructorN)


{


instructorName = instructorN;


courseName = courseN;


}





public void setInstructorName(String name)


{


instructorName = name;


}





public String getInstructorName()


{


return(instructorName);


}





public void displayMessage()


{


System.out.println("The welcome message, whatever it might be");


System.out.println("This course is presented by: " + instructorName);


}





}





Simple as that, however this will not help you learn the material, actually working through it will. Also, this is not the exact answer, as I have no clue what GradeBook is, or its base methods/attributes.


No comments:

Post a Comment