Hi, I'm new to Java...
I've been trying to get one of my professor's examples to work...
He says that the code is fine, but I keep getting 4 "cannot resolve symbol" errors when I try to compile the ShowStudent.jav a file...
The code for the Student class and ShowStudent program are listed below...
PLEASE HELP!!!
[CODE=java]// Student.java
// creates a class to store info about a student
class Student
{
// the private data members
private int IDnumber;
private int hours;
private int points;
// constructor added in last part of project
Student()
{
IDnumber = 77375;
points = 12;
hours = 3;
}
// end of constructor
// the public get and set methods
public void setIDnumber(int number)
{
IDnumber = number;
}
public int getPoints()
{
return points;
}
// methods to display the fields
public void showIDnumber()
{
System.out.prin tln("ID Number is: " + IDnumber);
}
public void showHours()
{
System.out.prin tln("Credit Hours: " + hours);
}
public void showPoints()
{
System.out.prin tln("Points Earned: " + points);
}
public double getGradePoint()
{
return (double)points / hours;
}
}
// ShowStudent.jav a
// client to test the Student class
class ShowStudent
{
public static void main (String args[])
{
student pupil = new student();
pupil.showIDnum ber();
pupil.showPoint s();
pupil.showHours ();
System.out.prin tln("The grade point average of the studnet created by constructor is "
+ pupil.getGradeP oint()+"\n\n");
Student s2 = new Student();
s2.setIDnumber( 12345);
s2.setPoints(66 );
s2.setHours(20) ;
s2.showIDnumber ();
s2.showPoints() ;
s2.showHours();
System.out.prin tln("The grade point average of another student is "
+ s2.getGradePoin t()+"\n");
}
}[/CODE]
I've been trying to get one of my professor's examples to work...
He says that the code is fine, but I keep getting 4 "cannot resolve symbol" errors when I try to compile the ShowStudent.jav a file...
The code for the Student class and ShowStudent program are listed below...
PLEASE HELP!!!
[CODE=java]// Student.java
// creates a class to store info about a student
class Student
{
// the private data members
private int IDnumber;
private int hours;
private int points;
// constructor added in last part of project
Student()
{
IDnumber = 77375;
points = 12;
hours = 3;
}
// end of constructor
// the public get and set methods
public void setIDnumber(int number)
{
IDnumber = number;
}
public int getPoints()
{
return points;
}
// methods to display the fields
public void showIDnumber()
{
System.out.prin tln("ID Number is: " + IDnumber);
}
public void showHours()
{
System.out.prin tln("Credit Hours: " + hours);
}
public void showPoints()
{
System.out.prin tln("Points Earned: " + points);
}
public double getGradePoint()
{
return (double)points / hours;
}
}
// ShowStudent.jav a
// client to test the Student class
class ShowStudent
{
public static void main (String args[])
{
student pupil = new student();
pupil.showIDnum ber();
pupil.showPoint s();
pupil.showHours ();
System.out.prin tln("The grade point average of the studnet created by constructor is "
+ pupil.getGradeP oint()+"\n\n");
Student s2 = new Student();
s2.setIDnumber( 12345);
s2.setPoints(66 );
s2.setHours(20) ;
s2.showIDnumber ();
s2.showPoints() ;
s2.showHours();
System.out.prin tln("The grade point average of another student is "
+ s2.getGradePoin t()+"\n");
}
}[/CODE]
Comment