I keep recieving an error on lines of code 77-80 and I'm not really sure what I'm doing wrong. They're all the same error and goes as follows:
----jGRASP exec: javac -g Program5.java

Program5.java:72: error: cannot find symbol
            adultTickets = adultTicketPriceTextField.getText();
                           ^
  symbol:   variable adultTicketPriceTextField
  location: class Program5.buttonListener
Program5.java:73: error: cannot find symbol
            adultSales = adultTicketSoldTextField.getText();
                         ^
  symbol:   variable adultTicketSoldTextField
  location: class Program5.buttonListener
Program5.java:74: error: cannot find symbol
            childTickets = childTicketPriceTextField.getText();
                           ^
  symbol:   variable childTicketPriceTextField
  location: class Program5.buttonListener
Program5.java:75: error: cannot find symbol
            childSales = childTicketSoldTextField.getText();
                         ^
  symbol:   variable childTicketSoldTextField
  location: class Program5.buttonListener
4 errors

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

Here is my code:

       import javax.swing.*;
       import java.awt.event.*;
       import java.awt.*;

       public class Program5 extends JFrame
       {
          public Program5()
          {

             final int windowWidth = 350;
             final int windowHeight = 275;


             setTitle("Theatre Revenue ");  
             setSize(windowWidth, windowHeight);
             JButton button = new JButton("Calculate ");
             button.addActionListener(new buttonListener());
             JTextField adultTicketPriceTextField;  
             adultTicketPriceTextField = new JTextField(20);
             JTextField adultTicketSoldTextField;   
             adultTicketSoldTextField = new JTextField(20);
             JTextField childTicketPriceTextField;
             childTicketPriceTextField = new JTextField(20);
             JTextField childTicketSoldTextField;
             childTicketSoldTextField = new JTextField(20);
             JLabel adultPrice;
             adultPrice = new JLabel("Adult Ticket Price ");
             JLabel adultSales;
             adultSales = new JLabel ("Adult Tickets Sold ");
             JLabel childPrice;
             childPrice = new JLabel ("Child Ticket Price ");
             JLabel childSales;
             childSales = new JLabel ("Child Tickets Sold ");
             JLabel spacer;
             spacer = new JLabel ("  ");
             JPanel panel1 = new JPanel();
             panel1.add(adultPrice);
             panel1.add(adultTicketPriceTextField);
             panel1.add(adultSales);
             panel1.add(adultTicketSoldTextField);
             panel1.add(childPrice);
             panel1.add(childTicketPriceTextField);
             panel1.add(childSales);
             panel1.add(childTicketSoldTextField);
             panel1.add(spacer);
             panel1.add(button);    
             add(panel1);
             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             setVisible(true);
          }
          private class buttonListener implements ActionListener
          {
             public void actionPerformed(ActionEvent e)
             {
                String adultTickets;
                double adultTicketsNum;
                String adultSales;
                double adultSalesNum;
                String childTickets;
                double childTicketsNum;
                String childSales;
                double childSalesNum;
                double adultGross;
                double adultNet;
                double childGross;
                double childNet;
                double totalGross;
                double totalNet;
                double constant = 0.20;


                adultTickets = adultTicketPriceTextField.getText();
                adultSales = adultTicketSoldTextField.getText();
                childTickets = childTicketPriceTextField.getText();
                childSales = childTicketSoldTextField.getText();

                adultTicketsNum = Double.parseDouble(adultTickets);
                adultSalesNum = Double.parseDouble(adultSales);
                childTicketsNum = Double.parseDouble(childTickets);
                childSalesNum = Double.parseDouble(childSales);

                adultGross = adultTicketsNum * adultSalesNum;
                adultNet = adultGross * constant;
                childGross = childTicketsNum * childSalesNum;
                childNet = childGross * constant;
                totalGross = adultGross + childGross;
                totalNet = adultNet + childNet;


                JOptionPane.showMessageDialog(null, "The Gross for Adult tickets was " + adultGross + 
                   " The Net for Adult Tickets was " + adultNet + " The Gross for Children Tickets was " +
                   childGross + " The Net for Child Tickets was " + childNet + " The Total Gross was " + 
                   totalGross + " The Total Net was " + totalNet);
             }
          }

       }

Make sure the variables are defined in the same scope (within the same pair of {}s) as where you are trying to use them. They need to be defined at the class level if you are going to reference them in different methods.

So if I move the

            JTextField adultTicketPriceTextField;   
              JTextField adultTicketSoldTextField;
              JTextField childTicketPriceTextField;
              JTextField childTicketSoldTextField;

up above the constructor Program5, I'll be good, right? And also where can I put a main in here because anywhere I put it gives me errors and I can't run without it.

This question has already been answered. Start a new discussion instead.