I have 22 errors for cannot find symbol.....Please help!

import javax.swing.*; 		//needed for swing classes
   import java.awt.event.*; 	// needed for the action listener
   import java.awt.*;			//needed for the boader layout class
   import java.io.*; 			//need for the file and IOException
   import java.util.Scanner;	// needed for the scanner class
   import java.util.List;  	// needed for the  arraylist
   import java.util.Arrays;  	//needed for the arraylict class
	
	/**
		Constructor
	*/
   

   public class project3 extends JFrame 
   {
   	
      public gradeTypePanel gradeType; //to reference the the grade Type Panel with the radio buttons
      public namePanel name; // to reference the name panel with the name text field
      public testPanel test;// to reference the test panel with the 3 test grade fields
      public resultPanel result;// to reference the result panel with the result text field
      private JPanel panel; // to reference the a  panel
      private JButton calcButton; // creats the Button named calcButton
      private JButton prevButton; // creats the Button named prevButton
      private JButton nextButton; // creats the Button named nextButton
      private JButton saveButton; // creats the Button named saveButton
      private JPanel buttonPanel; // to  reference the panel where all the buttons go
      public openFile open;// to reference the open file class
      public int masterIndex = -1; // this controls all the of the indexes of all 4 arrays
      
   	// constructs the window
      public project3()
      {
         // sets the title
         setTitle("Grade Program");
         // set what happens when the exit button is clicked
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         // sets the border layout
         setLayout(new BorderLayout());
         //calls the resultPanel class and names it result
         result = new resultPanel();
         //calls the gradeTypePanel and names it gradeType
         gradeType = new gradeTypePanel();
         //calls the namePanel and names it name
         name = new namePanel();
         //calls the testPanel and names it test
         test = new testPanel();
         
      	//builds the button panel
         buildButtonPanel();
      	
      	//adds all of the panels to the north, south, east, west, and center panels
         add(name, BorderLayout.NORTH);  
         add(gradeType, BorderLayout.WEST);
         add(test, BorderLayout.CENTER);
         add(buttonPanel, BorderLayout.EAST);
         add(result, BorderLayout.SOUTH);
         
      	// packs all the panels togather
         pack();
      	
      	//makes the window visable
         setVisible(true);
      }
      
      //builds the panel for the buttons
      private void buildButtonPanel()
      {
      
         buttonPanel = new JPanel();
                 
         
         prevButton = new JButton("Prev");// adds the text prev to the prevButton
         calcButton = new JButton("Calc Grade");// adds the text Calc Grade to the calcButton
         nextButton = new JButton("Next");// adds the text Next to the nextButton 
         saveButton = new JButton("Save");// adds the text Save to the saveButton
         
      	
         calcButton.addActionListener(new CalcButtonListener());// calls the  ActionListener for the calcButton
         prevButton.addActionListener(new PrevButtonListener());// calls the  ActionListener for the prevButto
         nextButton.addActionListener(new NextButtonListener());// calls the  ActionListener for the nextButton
         saveButton.addActionListener(new SaveButtonListener());// calls the  ActionListener for the addButton
      
         
         buttonPanel.add(prevButton);// adds the prevButton to the panel
         buttonPanel.add(saveButton);// adds the saveButton to the panel
         buttonPanel.add(nextButton);// adds the nextButton to the panel
         buttonPanel.add(calcButton);// adds the calcButton to the panel
         
         
      }
       //creats actionlistener for the Calc Grade button
      private class CalcButtonListener implements ActionListener
      {
      	// executes when the button is clickd 
         public void actionPerformed(ActionEvent e)
         {
           //if masterIndex = -1 then you are not at index 0 of the arrays so you cant calculate
            if(masterIndex != -1)
            {
               String nameText;// to save the text in the name text field
               nameText = name.txtname.getText();//gets the text form name text field
               String grade1;// to save the text in the test1 text field
               grade1 = test.test1TextFild.getText();//gets the text form test1 text field
               String grade2;// to save the text in the test2 text field
               grade2 = test.test2TextFild.getText();//gets the text form test2 text field
               String grade3;// to save the text in the test3 text field
               grade3 = test.test3TextFild.getText();//gets the text form test3 text field
            	
               //if the text in all 3 text field are  <= 100 calculate
               if(Double.parseDouble(grade1) <= 100 && Double.parseDouble(grade2) <= 100 && Double.parseDouble(grade3) <= 100)
               {
                  //convert and add all 3 grades together
                  double totalGrade = Double.parseDouble(grade1) + Double.parseDouble(grade2) + Double.parseDouble(grade3); 
               	//get the the avarage
                  double NumberGrade = (totalGrade / 300) * 100;
               	//to hold the letter grade
                  String letterGrade;
                  //if the alphabetical radio button is Selected get the letter grade
                  if(gradeType.alphabetical.isSelected())
                  
                  {
                  
                  
                     if(NumberGrade >= 90)
                     {
                        //sets letter grade to A
                        letterGrade = "A";
                     	//display the result in the result text field
                        result.textResult.setText(letterGrade);
                     
                     }
                     else if(NumberGrade >= 80)
                     {
                        //sets letter grade to B
                        letterGrade = "B";
                     	//display the result in the result text field
                        result.textResult.setText(letterGrade);
                     }
                     else if(NumberGrade >= 70)
                     {
                        //sets letter grade to C
                        letterGrade = "C";
                     	//display the result in the result text field
                        result.textResult.setText(letterGrade);
                     }
                     else if(NumberGrade >= 60)
                     {
                        //sets letter grade to D
                        letterGrade = "D";
                     	//display the result in the result text field
                        result.textResult.setText(letterGrade);
                     }
                     else if(NumberGrade < 60)
                     {
                        //sets letter grade to F
                        letterGrade = "F";
                     	//display the result in the result text field
                        result.textResult.setText(letterGrade);
                     }
                  
                  
                  }
               	//if numerical is Selected get the number grade
                  if(gradeType.numerical.isSelected())
                  {
                     //display the result in the result text field
                     result.textResult.setText(Double.toString(NumberGrade));
                  }
               }
               else
               {
                  //displays error message when all grades are not <= 100
                  JOptionPane.showMessageDialog(null, "All Grades must be less than or equal to (100)");
               }
            }
            else
            {
            	//shows error message when masterIndex == -1
               JOptionPane.showMessageDialog(null, "Please click (Next) first");
            }
         	
         }										
      }
      //creats actionlistener for the Calc prev button
      private class PrevButtonListener implements ActionListener
      {
      	// executes when the button is clickd gets the input and calcilates it
         public void actionPerformed(ActionEvent e)
         {
            //if masterIndex is > 0 
            if(masterIndex > 0)
            { 
               //decrament masterIndex by 1
               masterIndex--;
            	
               String[] nameList;//to store the array
               String[] test1;//to store the array
               String[] test2;//to store the array
               String[] test3;//to store the array
            
            
               try 
               {
               
                  nameList = open.getArrayName();//get the nameList array from the class
                  test1 = open.getArrayTest1();//get the test1 array from the class
                  test2 = open.getArrayTest2();//get the test2 array from the class
                  test3 = open.getArrayTest3();//get the test3 array from the class
                  name.txtname.setText(nameList[masterIndex]);//populate the txtname text field with the array
                  test.test1TextFild.setText(test1[masterIndex]);//populate the test1 text field with the array
                  test.test2TextFild.setText(test2[masterIndex]);//populate the test2 text field with the array
                  test.test3TextFild.setText(test3[masterIndex]);//populate the test3 text field with the array
               
               } 
                  catch (IOException x)
                  { 
                     //displays an error message
                     System.out.println("Error");
                  } 
            }
            
            else
            {
               JOptionPane.showMessageDialog(null, "There are no previous students");
            }
         
         }								
      }
      //creats actionlistener for the next button
      private class NextButtonListener implements ActionListener
      {
      	// executes when the button is clickd 
         public void actionPerformed(ActionEvent e)
         {
            //incrament masterIndex by 1
            masterIndex++;
            
            String[] nameList;//to store the array
            String[] test1;//to store the array
            String[] test2;//to store the array
            String[] test3;//to store the array
            
            
            try 
            {
               
               nameList = open.getArrayName();//get the nameList array from the class
               test1 = open.getArrayTest1();//get the test1 array from the class
               test2 = open.getArrayTest2();//get the test2 array from the class
               test3 = open.getArrayTest3();//get the test3 array from the class
               name.txtname.setText(nameList[masterIndex]);//populate the txtname text field with the array
               test.test1TextFild.setText(test1[masterIndex]);//populate the test1 text field with the array
               test.test2TextFild.setText(test2[masterIndex]);//populate the test2 text field with the array
               test.test3TextFild.setText(test3[masterIndex]);//populate the test3 text field with the array
            
                           	
            } 
               catch (IOException x)
               { 
                   //displays an error message
                  System.out.println("Error");
               } 
         }
         									
      }
      //creats actionlistener for the save button
      private class SaveButtonListener implements ActionListener
      {
      	// executes when the button is clickd 
         public void actionPerformed(ActionEvent e)
         {
         	//if masterIndex = -1 then you are not at index 0 of the arrays so you cant calculate
            if(masterIndex != -1)
            {
            
               try 
               {
               
                  String[] nameList;//to store the array
                  String[] test1;//to store the array
                  String[] test2;//to store the array
                  String[] test3;//to store the array
               
                  nameList = open.getArrayName();//get the nameList array from the class
                  test1 = open.getArrayTest1();//get the test1 array from the class
                  test2 = open.getArrayTest2();//get the test2 array from the class
                  test3 = open.getArrayTest3();//get the test3 array from the class
               
                  String saveName;// to save the text in the name text field
                  saveName = name.txtname.getText();//gets the text form name text field
                  String saveGrade1;// to save the text in the test1 text field
                  saveGrade1 = test.test1TextFild.getText();//gets the text form test1 text field
                  String saveGrade2;// to save the text in the test2 text field
                  saveGrade2 = test.test2TextFild.getText();//gets the text form test2 text field
                  String saveGrade3;// to save the text in the test3 text field
                  saveGrade3 = test.test3TextFild.getText();//gets the text form test3 text field
               
                  List<String> name1List = Arrays.asList(nameList); //treats the array as an arrayList 
                  List<String> test1List = Arrays.asList(test1);//treats the array as an arrayList
                  List<String> test2List = Arrays.asList(test2);//treats the array as an arrayList
                  List<String> test3List = Arrays.asList(test3);//treats the array as an arrayList
               
                  name1List.set(masterIndex, saveName);//changes of sets the value at the masterIndex to saveName
                  test1List.set(masterIndex, saveGrade1);//changes of sets the value at the masterIndex to saveGrade1
                  test2List.set(masterIndex, saveGrade2);//changes of sets the value at the masterIndex to saveGrade2
                  test3List.set(masterIndex, saveGrade3);//changes of sets the value at the masterIndex to saveGrade3
               
               //opens the file for writing
                  PrintWriter outputFile = new PrintWriter("name.txt");
               //writes the array to a text file
                  for(int index = 0; index < nameList.length; index++)
                  {
                     outputFile.println(nameList[index]);
                  }
               //closes the file	
                  outputFile.close();
               
               //opens the file for writing
                  PrintWriter outputFile1 = new PrintWriter("grade1.txt");
               //writes the array to a text file
                  for(int index1 = 0; index1 < test1.length; index1++)
                  {
                     outputFile1.println(test1[index1]);
                  }
               //closes the file
                  outputFile1.close();
               
               //opens the file for writing
                  PrintWriter outputFile2 = new PrintWriter("grade2.txt");
               //writes the array to a text file
                  for(int index2 = 0; index2 < test2.length; index2++)
                  {
                     outputFile2.println(test2[index2]);
                  }
               //closes the file
                  outputFile2.close();
               
               //opens the file for writing
                  PrintWriter outputFile3 = new PrintWriter("grade3.txt");
               //writes the array to a text file
                  for(int index3 = 0; index3 < test3.length; index3++)
                  {
                     outputFile3.println(test3[index3]);
                  }
               //closes the file
                  outputFile3.close();
               
               
               }  
                  catch (IOException x)
                  { 
                  //displays an error message
                     System.out.println("Error!");
                  }  
            }
            else
            {
            	//shows error message when masterIndex == -1
               JOptionPane.showMessageDialog(null, "Please click (Next) first");
            	
            }      
         }										
      }
   
      public static void main(String[] a)
      {
         // calls the project2 class
         new project2();
      	
      }
   }

ERRORS
----jGRASP exec: javac -g project3.java

project3.java:17: cannot find symbol
symbol : class gradeTypePanel
location: class project3
public gradeTypePanel gradeType; //to reference the the grade Type Panel with the radio buttons
^
project3.java:18: cannot find symbol
symbol : class namePanel
location: class project3
public namePanel name; // to reference the name panel with the name text field
^
project3.java:19: cannot find symbol
symbol : class testPanel
location: class project3
public testPanel test;// to reference the test panel with the 3 test grade fields
^
project3.java:20: cannot find symbol
symbol : class resultPanel
location: class project3
public resultPanel result;// to reference the result panel with the result text field
^
project3.java:27: cannot find symbol
symbol : class openFile
location: class project3
public openFile open;// to reference the open file class
^
project3.java:40: cannot find symbol
symbol : class resultPanel
location: class project3
result = new resultPanel();
^
project3.java:42: cannot find symbol
symbol : class gradeTypePanel
location: class project3
gradeType = new gradeTypePanel();
^
project3.java:44: cannot find symbol
symbol : class namePanel
location: class project3
name = new namePanel();
^
project3.java:46: cannot find symbol
symbol : class testPanel
location: class project3
test = new testPanel();
^
project2.java:17: cannot find symbol
symbol : class gradeTypeLabel
location: class project2
public gradeTypeLabel gradeType; // to reference the the grade Type Label with the radio buttons
^
project2.java:18: cannot find symbol
symbol : class namePanel
location: class project2
public namePanel name; // to reference the name panel with the name text field
^
project2.java:19: cannot find symbol
symbol : class testPanel
location: class project2
public testPanel test; // to reference the test panel with the 3 test grade fields
^
project2.java:20: cannot find symbol
symbol : class resultPanel
location: class project2
public resultPanel result; // to reference the result panel with the result text field
^
project2.java:27: cannot find symbol
symbol : class openFile
location: class project2
public openFile open; // to reference the open file class
^
project2.java:40: cannot find symbol
symbol : class resultPanel
location: class project2
result = new resultPanel();
^
project2.java:42: cannot find symbol
symbol : class gradeTypeLabel
location: class project2
gradeType = new gradeTypeLabel();
^
project2.java:44: cannot find symbol
symbol : class namePanel
location: class project2
name = new namePanel();
^
project2.java:46: cannot find symbol
symbol : class testPanel
location: class project2
test = new testPanel();
^
project2.java:76: cannot find symbol
symbol : class CalcButtonListener
location: class project2
calcButton.addActionListener(new CalcButtonListener());// calls the ActionListener for the calcButton
^
project2.java:77: cannot find symbol
symbol : class PrevButtonListener
location: class project2
prevButton.addActionListener(new PrevButtonListener());// calls the ActionListener for the prevButto
^
project2.java:78: cannot find symbol
symbol : class NextButtonListener
location: class project2
nextButton.addActionListener(new NextButtonListener());// calls the ActionListener for the nextButton
^
project2.java:79: cannot find symbol
symbol : class SaveButtonListener
location: class project2
saveButton.addActionListener(new SaveButtonListener());// calls the ActionListener for the addButton
^
22 errors

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

Recommended Answers

All 2 Replies

So where are all of those classes?

The definition for a class must be on the classpath for the javac or java program to find and use it.

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.