Q:

GUI for calculating the minimum amount of coins needed

I'm new to GUI building and slightly confused at the code below... When I run the program, it definitely runs but when you enter the amount of change, it doesn't calculate how many quarters, dimes, etc. it just puts a "0" in. I looked at my code and there aren't any errors.
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class MinCoinsGUI extends JFrame
{

    private JTextField changeTF = new JTextField(3);
    private JTextField quartersTF = new JTextField(3);
    private JTextField dimesTF = new JTextField(3);
    private JTextField nickelsTF = new JTextField(3);
    private JTextField penniesTF = new JTextField(3);

    public MinCoinsGUI()
    {
        JButton CalcChangeBTN = new JButton("Calculate");
        JButton ClearBTN = new JButton("Clear");

        CalcChangeBTN.addActionListener(new ChangeBTNListener());
        ClearBTN.addActionListener(new ClearBTNListener());

        quartersTF.setEditable(false);
        dimesTF.setEditable(false);
        nickelsTF.setEditable(false);
        penniesTF.setEditable(false);

        JPanel mainPanel = new JPanel();
        mainPanel.setLayout(new GridLayout(6, 2, 2, 2));

        mainPanel.add(new JLabel("Enter Change (1-99)"));
        mainPanel.add(changeTF);

        mainPanel.add(new JLabel("Quarters"));
        mainPanel.add(quartersTF);

        mainPanel.add(new JLabel("Dimes"));
        mainPanel.add(dimesTF);

        mainPanel.add(new JLabel("Nickels"));
        mainPanel.add(nickelsTF);

        mainPanel.add(new JLabel("Pennies"));
        mainPanel.add(penniesTF);

        mainPanel.add(CalcChangeBTN);
        mainPanel.add(ClearBTN);

        setContentPane(mainPanel);
        pack();
        setTitle("Minimum Coins");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
    }

    class ChangeBTNListener implements ActionListener
    {

        public void actionPerformed(ActionEvent e)
        {
            String changeString = changeTF.getText();
            int change = Integer.parseInt(changeString);

            String quartersString = changeTF.getText();
            int quarters = Integer.parseInt(quartersString);

            String dimesString = changeTF.getText();
            int dimes = Integer.parseInt(dimesString);

            String nickelsString = changeTF.getText();
            int nickels = Integer.parseInt(nickelsString);

            String penniesString = changeTF.getText();
            int pennies = Integer.parseInt(penniesString);

            while (change >= 25)
            {
                quarters++;
                change -= 25;
            }

            while (change >= 10)
            {
                dimes++;
                change -= 10;
            }

            while (change >= 5)
            {
                nickels++;
                change -= 5;
            }

            while (change >= 1)
            {
                pennies++;
                change -= 1;
            }

            changeTF.setText("" + change);
        }
    }

    class ClearBTNListener implements ActionListener
    {

        public void actionPerformed(ActionEvent e)
        {
            changeTF.setText("");
        }
    }

    public static void main(String[] args)
    {
        MinCoinsGUI window = new MinCoinsGUI();
        window.setVisible(true);
    }
}

A:

You're not setting the values in quartersTF, dimesTF and so on at all.  All you're doing is calculating the number of quarters, dimes and so on, all the while diminishing change until it reaches zero, then setting that zero back into changeTF.  If you want to see values in quartersTF, dimesTF and so on, you'll need to set them.

