I spent so much time from scratch to finish and to the point that I couldn't figured out what is all my mistakes about. I need a fresh set of eye, may you help? (errors at the bottom, sorry for have to scroll down the long page) Thanx

/*
*Description: Writing own method, Switch Selection Control, String,Accumulating, 
*Counting method, array base on last reviews from previous labs.
*prepare a grade report for more than 1 student using input File and
*output to a File with print outs letter grades # of A's, B's etc.
*Input: College Name, Student Name, Student ID Number and
*Courses-Section Name (ex. CISC115.59), Letter Grades  
*Output: College Name, Student Name, Student ID Number;  
*Courses, Letter Grades, Grade Points, GPA and total students grades. 
*/


import java.io.*; //Needed for File classes
import java.util.*; //Needed for scanner classes




public class gpa
{
	public static void main(String[] args)throws Exception
	{									
					
		// declare inFile & associate with actual data file
		Scanner inFile = new Scanner(new FileReader("inputgpa.txt"));
		
		//Read numStudents from first line of inputgpa file
		int numStudents = inFile.nextInt(); //total number of students
		
		// declare outFile & associate with actual data file
		PrintWriter outFile = new PrintWriter("outputgpa.txt");
		
		//Print College name to file
		outFile.println("BCCC"+"Grade Report for "+ numStudents+"students");
				

		// Continue if there is more data in inputgpa file
		while (inFile.hasNext())
		{
			//Read Name & idNumber from inputgpa file
			String Name = inFile.nextLine(); // student name in file
			int idNumber = inFile.nextInt(); //student ID number
			
			// Output to file
			outFile.println("\t\t\t"+Name);
			outFile.println("\t\t\t"+idNumber);
			
			//print 1 blank line
			outFile.println();
			
			//Write to file for headings 
			outFile.println("Couse\t\t"+"Grade\t\t"+"Gradepoints");
			
			//Call studentCourses method for student gp & gpa calculation
			studentCourses();
			
		}//End While loop then close the inputgpa file
		inFile.closed();
		
	}//End Main method
	
	
	/** ___________________________________________________________
	 This loop for colecting the 6 courseName and their letGrade of
	 each student from the inputgpa file, then calculate the gp & gpa
	 */
	 public static void studentCourses()
	 {
	 	//continue read from inputgpa file
		while(inFile.hasNext())
		{
			//Declare variable n & its value
			int n = 6; //total of student courses
			int i=0; 
			//start loop
			for(i=0; i<n; i++)
			{
				//read courseName
				String courseName = inFile.nextLine();
				String letGrade = inFile.nextLine();
			
				//Pass the array to the gradeSortout method
				gradeSortout();
				
				double gp=0.0; // grade point
			
				//compute gp from input letGrade
				switch(letGrade)
				{
					case 'A': gp=4; break;
					case 'B': gp=3; break;
					case 'C': gp=2; break;
					case 'D': gp=1; break;
					case 'F': gp=0; break;
					default: System.out.println("Invalid Grade"); break;
				}//End switch loop
			
			//compute to find total gradepoints
			double totalgp = 0.0;
			totalgp+= gp;
			
			//Read values then output to outputgp file
			outFile.println(courseName+"\t\t"+letGrade+"\t\t"+gp);
			}//End For loop
			
			//Compute gpa
			double gpa = 0.0;
			gpa = totalgp / n;
			
			//Read gpa and output to outputgpa file
			//print line
			outFile.println("-------------------------------");
			
			//display gpa as footer
			outFile.println("GPA: "+gpa);
			
	 	}//End While loop
	}//End studentCourses method
	
	// ___________________________________________________________________
	//Begin gradeSortout method  

	
	public static void gradeSortout()
	{
		// declare outGrade & associate with actual data file
		PrintWriter outGrade = new PrintWriter("Grade.txt");
		
		//Print to Grade file
		outGrade.println("BCCC"+"Grade Results Report of "+ numStudents+"students "+"- Spring 2011-");
		
		//calculate the total grades of all students for array uses
		int sum = numStudent*n;
		int[]gradeArray = new int[numStudent*n];
		int j=0;
		
		//start loop for gradeSortout
		for(j=0; j<sum; j++)
		{
			gradeArray[j] = 0;
			
			switch(letGrade)
			{
				case'A':outGrade.format(format,(j+1)+"A"); break;
				case'B':outGrade.format(format,(j+1)+"A"); break;
				case'C':outGrade.format(format,(j+1)+"A"); break;
				case'D':outGrade.format(format,(j+1)+"A"); break;
				case'F':outGrade.format(format,(j+1)+"A"); break;
				default:outGrade.println("invalid grade"); break;
			}
			
			//print to Grade file in table layout
			outGrade.println("________________________________________");
			outGrade.println();//one blank line
			
			String format = "%1$-10s%2$-10s%3$-10s%4$-10s%5$-10s%6$-10s\n";
			
			//print headings
			outGrade.format(format,"Number","A Grade", "B Grade", "C Grade", "D Grade", "F Grade");
			
			 
		}//End for loop		
		
	}//End gradeSortout method
	
}//End
symbol  : variable inFile
location: class gpa
		while(inFile.hasNext())
		      ^
gpa.java:82: cannot find symbol
symbol  : variable input
location: class gpa
				String courseName = input.nextLine();
				                    ^
gpa.java:83: cannot find symbol
symbol  : variable input
location: class gpa
				String letGrade = input.nextLine();
				                  ^
gpa.java:86: gradeSortout(int[]) in gpa cannot be applied to ()
				gradeSortout();
				^
gpa.java:91: incompatible types
found   : java.lang.String
required: int
				switch(letGrade)
				       ^
gpa.java:106: cannot find symbol
symbol  : variable outFile
location: class gpa
			outFile.println(courseName+"\t\t"+letGrade+"\t\t"+gp);
			^
gpa.java:111: cannot find symbol
symbol  : variable totalgp
location: class gpa
			gpa = totalgp / n;
			      ^
gpa.java:115: cannot find symbol
symbol  : variable outFile
location: class gpa
			outFile.println("-------------------------------");
			^
gpa.java:118: cannot find symbol
symbol  : variable outFile
location: class gpa
			outFile.println("GPA: "+gpa);
			^
gpa.java:134: cannot find symbol
symbol  : variable numStudents
location: class gpa
		outGrade.println("BCCC"+"Grade Results Report of "+ numStudents+"students "+"- Spring 2011-");
		                                                    ^
gpa.java:137: cannot find symbol
symbol  : variable numStudent
location: class gpa
		int sum = numStudent*n;
		          ^
gpa.java:137: cannot find symbol
symbol  : variable n
location: class gpa
		int sum = numStudent*n;
		                     ^
gpa.java:138: cannot find symbol
symbol  : variable numStudent
location: class gpa
		int[]gradeArray = new int[numStudent*n];
		                          ^
gpa.java:138: cannot find symbol
symbol  : variable n
location: class gpa
		int[]gradeArray = new int[numStudent*n];
		                                     ^
gpa.java:146: cannot find symbol
symbol  : variable letGrade
location: class gpa
			switch(letGrade)
			       ^
gpa.java:148: cannot find symbol
symbol  : variable format
location: class gpa
				case'A':outGrade.format(format,(j+1)+"A"); break;
				                        ^
gpa.java:149: cannot find symbol
symbol  : variable format
location: class gpa
				case'B':outGrade.format(format,(j+1)+"A"); break;
				                        ^
gpa.java:150: cannot find symbol
symbol  : variable format
location: class gpa
				case'C':outGrade.format(format,(j+1)+"A"); break;
				                        ^
gpa.java:151: cannot find symbol
symbol  : variable format
location: class gpa
				case'D':outGrade.format(format,(j+1)+"A"); break;
				                        ^
gpa.java:152: cannot find symbol
symbol  : variable format
location: class gpa
				case'F':outGrade.format(format,(j+1)+"A"); break;

Use the CODE-tags

25 posts and you still don't know about posting your code properly indented and in code tags. Your compiler error messages have the line numbers, but do you expect people to count the lines in your code to see which they are? We're willing to help, but we are not psychics.

I did pressed in the code tags (there are two) and previewed my post a couple of different times, even though there was one I have coded it right but it was by luck. I read the note on this site here but still got that problem. How should I do it? and if the preview option should show how it will look

? I'll start a new thread and try it again so the page won't add up with too many things. Thanx for all the effort!

Remind me, Tracy, if you could... what does "Cannot find symbol" mean again?
I know we went over this before, but I seem to have forgotten...

Remind me, Tracy, if you could... what does "Cannot find symbol" mean again?
I know we went over this before, but I seem to have forgotten...

Is it because I haven't declare it?
If it is right. I have a question, this time I use "call method" from the "main method". I thought once I already declare variables in main, I don't have to at others method.
I figured out how to wrap the coding. May I see you at my part 2?

Is it because I haven't declare it?
If it is right. I have a question, this time I use "call method" from the "main method". I thought once I already declare variables in main, I don't have to at others method.

You did declare them in main. However, a variable declared within a method doesn't exist outside that method.

public class foo
{
  int i;      // class visibility
  private void a()
  {
    int j = 2;  // local visibility
    i = 17;    
  }

  public static void main (String[] args)
  {
     System.out.println("i = " +i);  // okay
     System.out.println("j = " +j);  // error!

  }
}

You did declare them in main. However, a variable declared within a method doesn't exist outside that method.

public class foo
{
  int i;      // class visibility
  private void a()
  {
    int j = 2;  // local visibility
    i = 17;    
  }

  public static void main (String[] args)
  {
     System.out.println("i = " +i);  // okay
     System.out.println("j = " +j);  // error!

  }
}

Got you! I'll try to look my program over.

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.