Errors in my third Java assignment
This is my third Java assignment for my class and i'm already having lots of trouble..It's kind of frustrating, especially since I know I have a loong way to go and this should be pretty basic. I guess patience is a virtue though:o
I have two java files that have to be slightly modified. What they want is this...
1) Include a String instance variable 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 to output the welcome message and course name, followed by "This course is presented by:" and the instructors name.
Here is what I have so far---(first file--Gradebook)
I included the lines where it says I have errors.
Code:
public class GradeBook
{
private String courseName; // course name for this GradeBook
private String instructorName; // instructor's name for this Gradebook
// constructor initializes courseName and
// instructor name with String argument
public GradeBook ( String courseName, String instructorName)
{
**ln13** courseName = name;
**ln14** instructorName = name;
} // 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
//method to set the instructor name
public void setInstructorName ( String name )
{
**ln32** InstructorName = name; // 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
and the second file--(GradeBookTest)
Code:
public class GradeBookTest
{
//main method begins program execution
public static void main ( String [] args )
{
// create GradeBook Object
GradeBook gradeBook1 = new GradeBook(
"CS101 Introduction to Java Programming" , "Hank Hill" );
GradeBook gradeBook2 = new GradeBook(
"CS102 Data Structures in Java", "Dale Gribble" );
// display initial value of courseName for each Gradebook
System.out.printf( "gradeBook1 course name is: %s\n",
**ln18** gradeBook1.getCourseName() );
System.out.printf( "gradeBook2 course name is: %s\n",
**ln20** gradeBook2.getCourseName() );
System.out.printf( "This course is presented by: %s\n",
**ln23** gradebook1.getInstructorName() );
System.out.printf( "This course is presented by: %s\n",
**ln25** gradebook2.getInstructorName() );
} // end main
} // end class GradeBookTest
This what the errors say when I run it in the command prompt.
Code:
C:\Examples\ch03\fig03_10_11>javac *.java
GradeBook.java:13: cannot find symbol
symbol : variable name
location: class GradeBook
courseName = name;
^
GradeBook.java:14: cannot find symbol
symbol : variable name
location: class GradeBook
instructorName = name;
^
GradeBook.java:32: cannot find symbol
symbol : variable InstructorName
location: class GradeBook
InstructorName = name; // store the instructor name
^
GradeBookTest.java:18: cannot find symbol
symbol : method getCourseName()
location: class GradeBook
gradeBook1.getCourseName() );
^
GradeBookTest.java:20: cannot find symbol
symbol : method getCourseName()
location: class GradeBook
gradeBook2.getCourseName() );
^
GradeBookTest.java:23: cannot find symbol
symbol : variable gradebook1
location: class GradeBookTest
gradebook1.getInstructorName() );
^
GradeBookTest.java:25: cannot find symbol
symbol : variable gradebook2
location: class GradeBookTest
gradebook2.getInstructorName() );
^
7 errors
If someone could push me in the right direction, that would be much appreciated.