Please help - Grade analyzer causing many problems


#1


Link to Grade Analyzer Project

https://www.codecademy.com/courses/learn-java/projects/grades-analyzer

Error Messages

GradeAnalyzer.java:4: error: missing method body, or declare abstract
public int getAverage(ArrayList grades); {
^
GradeAnalyzer.java:5: error: cannot find symbol
if (grades.size()<1) {System.out.println("There are no grades saved here fella!");
^
symbol: variable grades
location: class GradeAnalyzer
GradeAnalyzer.java:6: error: return outside method
return 0;
^
GradeAnalyzer.java:10: error: cannot find symbol
for (int grade : grades){sum=sum+grade;}//End of for each loop
^
symbol: variable grades
location: class GradeAnalyzer
GradeAnalyzer.java:11: error: cannot find symbol
int average = sum/grades.size();
^
symbol: variable grades
location: class GradeAnalyzer
GradeAnalyzer.java:13: error: return outside method
return average;
^
GradeAnalyzer.java:17: error: cannot find symbol
ArraryList myClassroom = new ArrayList();
^
symbol: class ArraryList
location: class GradeAnalyzer
GradeAnalyzer.java:17: error: cannot find symbol
ArraryList myClassroom = new ArrayList();
^
symbol: class Intger
location: class GradeAnalyzer
8 errors

import java.util.ArrayList;//Import Java package ArrayList
class GradeAnalyzer {
	public void GradeAnalyzer() {};//End GradeAnalyzer Constructor
			public int getAverage(ArrayList<Integer> grades); {
  			if (grades.size()<1) {System.out.println("There are no grades saved here fella!");
  			return 0;
       }//End of if statement
  			else {
          int sum = 0;
          for (int grade : grades){sum=sum+grade;}//End of for each loop
          int average = sum/grades.size();
          System.out.println(average);
          return average;
        }//End of else statement
			}//End of getAverage Method
  	public static void main(String[] args) {
      ArraryList<Integer> myClassroom = new ArrayList<Intger>();
      	myClassroom.add(98);
      	myClassroom.add(92);
      	myClassroom.add(88);
      	myClassroom.add(75);
      	myClassroom.add(61);
      	myClassroom.add(89);
      	myClassroom.add(96);
     GradeAnalyzer myAnalyzer = new GradeAnalyzer(); 
     myAnalyzer.getAverage(myClassroom); 
    }//End of main method
}//End of GradeAnalyzer Class

#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.