GradeBook Class Modifications
I am very new to programming in java and i am completely stuck on this problem i just dont see what i am doing wrong, if i could get some clarification that would be great.
i need this program to display the courses name and instructors name when entered by the person using the program
Code:
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\n%s!\n", getCourseName());
} // end method displayMessage
}//end class GradeBook
Code:
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\n",
gradeBook.getcourseName() );
System.out.printf ( "gradeBook2 course name is: %s\n",
gradeBook2.getcourseName() );
} // end main
} // end class GradeBookTest
Code:
GradeBookTest.java:26: cannot find symbol
symbol : variable gradeBook
location: class GradeBookTest
gradeBook.getcourseName() );
^
GradeBookTest.java:28: cannot find symbol
symbol : method getcourseName()
location: class GradeBook
gradeBook2.getcourseName() );
^
2 errors