I have been incurring errors during compile, in which I cannot seem to figure out where the problem relies. I have a class file which is different from the java file. When running the java file im recieving the error of cannot find symbol. {note both of the files are in the same folder}

The Class file

public class Student{
	private String studentName;
    private String studentEmail;
    private String studentLocation;
    private int[] projectGrade = new int[4];
    private int[] quizGrade = new int [2];
    private int finalExam;
    private int participationGrade;
	public double finalGrade;

// Default Constructor
	public Student(){
	}
	
	public void setStudentName(String student){
	  studentName = student;
	}
	public String getStudentName(){
	  return studentName;
	}


	public void setStudentEmail(String email){
	  studentEmail = email;
	}
	public String getStudentEmail(){
	  return studentEmail;
	}

    public void setStudentLocation(String location){
	  studentLocation = location;
	}
	public String getStudentLocation(){
	  return studentLocation;
	}

// Method for Array projectGrades(4)
	public void setProjectGrade(int num1, int num2){
		projectGrade[num1] = num2; 

		projectGrade[0] = num2;
		projectGrade[1] = num2;
		projectGrade[2] = num2;
		projectGrade[3] = num2;         
	}
	public int getProjectGrade(){
		return projectGrade[4];
	}
	
//Method for Array quizGrades(2)
   public void setQuizGrade(int num1, int num2){
		quizGrade[0] = num2;
		quizGrade[1] = num2;
	}
	public int getQuizGrade(){
		return quizGrade[2];
	}

	public void setFinalExam(int exam){
		finalExam = exam;
	}
	public int getFinalExam(){
		return finalExam;
	}

	public void setParticipationGrade(int participationGrade){
 
	}

	public double finalGrade(){
		double grade;
		grade = (/*(projectGrade[0] * 0.1) + (projectGrade[1] * 0.1) + (projectGrade[2] * 0.1) + (projectGrade[3] * 0.1) + */(quizGrade[0] * .05) + (finalExam * .25) + (participationGrade * .25));
		return grade;
	}

	public void studentReport(){
	System.out.println("Student: " + studentName);
	System.out.println("Location: " + studentLocation);
	System.out.println("Contact Information: " + studentEmail);
	System.out.println("Grade Report");
	System.out.println("----------------------------");
	System.out.println("Quiz 1 " + quizGrade[0]);
	System.out.println("Quiz 2 " + quizGrade[1]);
	System.out.println("Project 1 " + projectGrade[0]);
	System.out.println("Project 2 " + projectGrade[1]);
	System.out.println("Project 3 " + projectGrade[2]);
	System.out.println("Project 3 " + projectGrade[3]);
	System.out.println("----------------------------" + "\n");
	System.out.println("Final Grade: " + finalGrade);
	}

}

The java file

public class gradeBookDriver {

public static void main (String[] args) {

Student cmis141Student1 = new Student();
Student cmis141Student2 = new Student();

cmis141Student1.setStudentName("Andy");
cmis141Student1.setStudentEmail("andy@hotmail.com");
cmis141Student1.setStudentLocation("UK");
cmis141Student1.setProjectGrade(1,100);
cmis141Student1.setProjectGrade(2,90);
cmis141Student1.setProjectGrade(3,85);
cmis141Student1.setProjectGrade(4,95);
cmis141Student1.setQuizGrade(1,100);
cmis141Student1.setQuizGrade(2,80);
cmis141Student1.setFinalExam(80);
cmis141Student1.participationGrade();



cmis141Student2.setStudentName("Heather");
cmis141Student2.setStudentEmail("heather@hotmail.com");
cmis141Student2.setStudentLocation("Germany");
cmis141Student2.setProjectGrade(1,100);
cmis141Student2.setProjectGrade(2,95);
cmis141Student2.setProjectGrade(3,95);
cmis141Student2.setProjectGrade(4,65);
cmis141Student2.setQuizGrade(1,80);
cmis141Student2.setQuizGrade(2,90);
cmis141Student2.setFinalExam(85);
cmis141Student2.participationGrade();


cmis141Student1.studentReport();
cmis141Student2.studentReport();

} // end of main() method
} // end of gradeBookDriver

Recommended Answers

All 3 Replies

screen shot attached

While compiling your so called java file you must save it with name of the class in your case it is gradeBookDriver and after seeing your screenshot I found that you are
using filename different from the name of your class
The actual name of your class is gradeBookDriver

and you are using gradebookdriver

So, correct your spelling.

Sorry Dupron, but no cigar. Windows file names are not case sensitive.

The message was about
cmis141Student1.participationGrade();
There is no such method in that class, so the symbol is undefined.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.