Hey guyz im beginner from java programming. Could anyone please help me fix my problem?

I have this method

public void determineClassAverage()
    {
        Scanner input = new Scanner(System.in);

            int total; // sum of grade
            int gradeCounter; //number of grade to be entered NEXT
            int grade; // grade value
            int average; // avarage of grades

            //initialization phase
            total = 0; //initial total
            gradeCounter = 1; // loop counter

            //processing phase
            while (gradeCounter <= 10)//loop 10 times
            {
                System.out.print("Enter: ");
                    grade = input.nextInt();
                    total = total + grade;
                    gradeCounter = gradeCounter + 1; //increment counter by 1
            } //end of while

            average = total/10;

                System.out.printf("\nTotal of all 0 grades is %d\n", total);
                System.out.printf("\nClass average is %d\n", average);

    } //end of determineClassAverage

---------------------------------------------------------------------------

and I want to call in the other file

public class GradeBookTest {

    // main method begins program excution
    public static void main(String[] args)
        {

        // create GradeBook object
        GradeBook myGradeBook = new GradeBook("CS1 Intro Java Prog");

    myGradeBook.displayMessage();
    myGradeBook.determineClassAverage();
    }
}

it gives me an error

C:\Users\DonCripz\Documents\JCreator LE\MyProjects\GradeBook\GradeBookTest\src\GradeBookTest.java:11: cannot find symbol
symbol  : method determineClassAverage()
location: class GradeBook
    myGradeBook.determineClassAverage();
               ^

can you help me fix this problem? please!

Please indent your code by highlighting it and pushing the TAB key. Use Edit Post to edit your post inside 30 min of writing it. See the help on right corner of Edit box (Formatting Help) for futher info.

It's saying that the class GradeBook does not have a method determineClassAverage() . Without all the code for GradeBook we can't say why that happens.

other possibility: you do have that method in your GradeBook class, but you haven't compiled it since you added that method.

Here is the whole code of my GradeBook

import java.util.Scanner;

public class GradeBook {

    private String courseName; //course name for this grade book

    // constructor initializes courseName with String supplied as argument
    public GradeBook( String name )
    {
        courseName = name;
    } //end of GradeBook

    // method to setCourseName
    public void setCourseName (String name)
    {
        courseName = name; // store the course name
    } //end of setCourseName

    //method to retireve the course name
    public String getCourseName()
    {
        return courseName;
    } // end of getCourseName

    // third method
public void displayMessage()
   {
System.out.printf("Welcome to the Grade book for\n%s!\n\n", getCourseName() );
   } //end of displayMessage

    // determine class average based on 10 grades entered by user
    public void determineClassAverage()
    {
        Scanner input = new Scanner(System.in);

        int total;
        int gradeCounter;
        int grade;
        int average;

        total = 0;
        gradeCounter = 1;

        while ( gradeCounter <= 10)
        {
            System.out.print("Enter grade: ");
            grade = input.nextInt();
            total = total + grade;
            gradeCounter = gradeCounter + 1;
        }

        average = total/10;

        System.out.printf("\nTotal of all 10 grades is %d\n", total);
        System.out.printf("Class average is %d\n", average);

    } //end of determineClassAverage

} //end of class GradeBook

I have already compiled the file. The method displayMessage() runs but the method determineClassAverage() is not.

The code looks OK. Suggest you clear out all .class files and (especially) all previous versions, alternative directories etc and re-compile.

Sir JamesCherrill, Thank You so much!!!! the code runs now....

what i did is to delete all the files to clear out all and made new one.
I do not delete the code ofcourse, I just copy it into notepad and paste it again.

btw, I just got one problem, after I made the new one and before it runs.... I have need to copy the GradeBook.class to the GradeBookTest classes folder in order for me to run the code. Because if i did not it only says "cannot find symbol class GradeBook"

Is there any way rather than doing this?

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.