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.java file...
The code for the Student class and ShowStudent program are listed below...
PLEASE HELP!!!
Expand|Select|Wrap|Line Numbers
- // 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.println("ID Number is: " + IDnumber);
- }
- public void showHours()
- {
- System.out.println("Credit Hours: " + hours);
- }
- public void showPoints()
- {
- System.out.println("Points Earned: " + points);
- }
- public double getGradePoint()
- {
- return (double)points / hours;
- }
- }
- // ShowStudent.java
- // client to test the Student class
- class ShowStudent
- {
- public static void main (String args[])
- {
- student pupil = new student();
- pupil.showIDnumber();
- pupil.showPoints();
- pupil.showHours();
- System.out.println("The grade point average of the studnet created by constructor is "
- + pupil.getGradePoint()+"\n\n");
- Student s2 = new Student();
- s2.setIDnumber(12345);
- s2.setPoints(66);
- s2.setHours(20);
- s2.showIDnumber();
- s2.showPoints();
- s2.showHours();
- System.out.println("The grade point average of another student is "
- + s2.getGradePoint()+"\n");
- }
- }