Here is what I had to do:
In this project each individual will create a data analysis program that will at a minimum, 1) read data in from a text file, 2) sort data in some way, 3) search the data in some way, 4) perform at least three mathematical manipulations of the data, 5) display results of the data analysis in numeric/textual form, and 6) display graphs of the data. In addition, 7) your program should handle invalid input appropriately and 8) your program should use some “new” feature that you have not been taught explicitly in class. (Note: this is to give you practice learning new material on your own – a critical skill of today’s programmer.) If you do not have a specific plan in mind for your project, below is a specific project that meets all of the qualifications as long as 7) and 8) are addressed in the implementation.

Everyrthing is doen except I need to call my methods in my GradeTester. I am struggling with this a lot, and you would think I would know by now but everything I have tried has not worked. So, please please help me out! Thank You!

GradeBook:

public class GradeBook {

    public final int MAXARRAY_SZ = 20;
    double [] scores = new double [MAXARRAY_SZ]; 
    int lastGrade = 0;
    double mean = 0;


    public GradeBook() {

        for (int i=0; i< scores.length; i++ ) {
            scores[i] = 0;
        }
    }

    public void addToGradeBook(int grade) {


        scores[lastGrade] = grade;
        lastGrade++;



    }

    public void sort()
    {  
        for (int i = 0; i < lastGrade; i++)
        { 
            for (int j=1; j< lastGrade; i++){
                if (scores[j-1]>scores[j])
                {
                    double temp = scores[j];
                    scores[j]= scores[j-1];
                    scores[j-1]=temp;
                }

            }
        }
    }

    public boolean linearSearch(int key) 
    {
        int index = 0;
        while(index < lastGrade) {
            if(scores[index] == key) {
                return true;
            }
            if(scores[index] > key) 
            {
                return false;
            }
            index++;
        }
        return false;
    }

    public void outputHistogram(String inputFileName)
    {
        String z = ""; 
        String y ="";
        for (int i=0; i < scores.length; i++);
        if (scores[lastGrade] > 70) {
            z += "a";
        } else if  (scores[lastGrade] < 50) {
            y += "b";
        }
        System.out.println(inputFileName + "(" + z);
        System.out.println(inputFileName + "(" + y);


    }

    public String toString(){     //to string
        String grades = "";
        //System.out.println(lastGrade);
        for (int i = 0; i < lastGrade; i++){    //go through each spot in array and print it
            //System.out.println("Scores" + i + scores[i]);
            grades = grades + scores[i];

        }
        return grades;
    }

    public double mean() {
        //Calculating mean


        double gradesTotal = 0;
        for (int i=0; i<scores.length; i++)
        {
            gradesTotal = gradesTotal + scores[i];
        }
        mean = gradesTotal/scores.length;
        return gradesTotal;

    }

    public double variance() {
        //Calculating standard deviation
        double variance = 0;
        for (int i=0; i<scores.length; i++)
        {
            variance = variance + (Math.pow((scores[i] - mean), 2));  
        }
        variance = variance / scores.length;
        double standardDeviation = Math.sqrt(variance);
        System.out.println(variance);
        return variance;
    }

    public double median(){
        //Finding median score
        double median;
        if (scores.length % 2 == 0)
            median = ((scores[(scores.length/2) - 1]) + scores[(scores.length/2)]) / 2;
        else
            median = scores[(scores.length/2)];
        return median;
    }

}

GradeTester:

/**
 * @author Allison Cather 
 * Date: 4/11/2015
 * Course: CS 220
 * Assignment: Final Lab
 */

/**
 *This class tests the class called GradeBook.
 *It creates a new object of GradeBook.
 *This class scans in the inputFile created with the array of grades.
 *It reads the file requested 
 */


import java.util.*;
import java.io.*;
import java.lang.*;

public class GradeTester
{
    public static void main(String[] args) throws IOException 
    {

        GradeBook science = new GradeBook();

        Scanner console = new Scanner(System.in);
        System.out.println("Enter the name of the file");
        String inputFileName = console.nextLine();

        File inputFile = new File(inputFileName);
        Scanner scan = new Scanner(inputFile);



        //declaring that whatever the first number in the document is, is how many indexes the document has
        while (scan.hasNext())
        {
            int x = scan.nextInt();
            science.addToGradeBook(x);
            //System.out.println("x is " + x);
            //System.out.println(science);
        }


        console.close();
    }

}

well, since you only have instance methods, you'll need to call them through an instance, which you are actually doing
science.addToGradeBook(x);
so I don't really see what your problem is. Can you be more specific as to what it is you need help with?

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.