Credit card(parent)Debitcard(child). At the file menu if you choose "credit"+"new Account" the parent works fine. At the file menu if you choose "debit"+"new Account" the child does not work. I am haveing trouble creating a new object which is the debit class which uses its super (credit class) Can any one help me understand once and for all when to create a new object ? The concept of using super(); is new to me.

/*
 * CGui.java
 *
 * Created on October 17, 2007, 5:27 PM
 */

package creditcard;
import creditcard.ProcessCard;
import creditcard.DebitCard;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.BorderFactory.*;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JMenuBar;
import javax.swing.JFrame.*;
import java.awt.Container;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JPanel;
import creditcard.ProcessCard;
import creditcard.DebitCard;
import javax.swing.WindowConstants;
import java.awt.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.MouseEvent;
import java.lang.String;
/**
 *
 * @author  fpcampus
 */
public class CGui extends javax.swing.JFrame implements ActionListener{
    private ProcessCard pc =new ProcessCard();
    private DebitCard db = new DebitCard();
    private JFrame frame;
    private ActionEvent evt;
    
    /** Creates new form CGui */
    //one to one:(debit,credit:"AcctTypeCode",1,2)(existing,new:"acctStatusCode",1,2)
    //
    private CGui() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        jPanel1 = new javax.swing.JPanel();
        header = new javax.swing.JLabel();
        acctjLbl = new javax.swing.JLabel();
        acctNojTxtFld = new javax.swing.JTextField();
        submitjBtn = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tempjTxtArea = new javax.swing.JTextArea();
        jRadioButton1 = new javax.swing.JRadioButton();
        acctheaderjLbl = new javax.swing.JLabel();
        sum1jLbl = new javax.swing.JLabel();
        jRadioButton2 = new javax.swing.JRadioButton();
        utilityjBtn = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        statusjLbl = new javax.swing.JLabel();
        pymtjLbl = new javax.swing.JLabel();
        rqstjLbl = new javax.swing.JLabel();
        chrgjTxtFld = new javax.swing.JTextField();
        pymtjTxtFld = new javax.swing.JTextField();
        rqstjTxtFld = new javax.swing.JTextField();
        descjLbl = new javax.swing.JLabel();
        descjTxtFld = new javax.swing.JTextField();
        chrgjBtn = new javax.swing.JButton();
        pymtjBtn = new javax.swing.JButton();
        rqstjBtn = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        chrgjLbl = new javax.swing.JLabel();
        jMenuBar2 = new javax.swing.JMenuBar();
        File = new javax.swing.JMenu();
        Credit = new javax.swing.JMenu();
        crexistingacct = new javax.swing.JMenuItem();
        crnewacct = new javax.swing.JMenuItem();
        Debit = new javax.swing.JMenu();
        dbexistingacct = new javax.swing.JMenuItem();
        dbnewacct = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jPanel1.setBackground(new java.awt.Color(156, 191, 211));
        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        header.setFont(new java.awt.Font("Bookman Old Style", 1, 14));
        header.setText("WELCOME TO THE CREDIT CARD SIMULATOR!");

        acctjLbl.setText("Account");

        submitjBtn.setText("SUBMIT");
        submitjBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitjBtnActionPerformed(evt);
            }
        });

        tempjTxtArea.setColumns(20);
        tempjTxtArea.setRows(5);
        tempjTxtArea.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(0, 51, 255), null, null));
        jScrollPane1.setViewportView(tempjTxtArea);

        jRadioButton1.setText("Credit");
        jRadioButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0));

        acctheaderjLbl.setText("Account Number");

        sum1jLbl.setText("Summary");

        jRadioButton2.setText("Debit");
        jRadioButton2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));

        utilityjBtn.setBackground(new java.awt.Color(0, 0, 0));
        utilityjBtn.setForeground(new java.awt.Color(255, 51, 51));
        utilityjBtn.setText("utility");
        utilityjBtn.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(255, 0, 10), new java.awt.Color(130, 132, 116)));
        utilityjBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                utilityjBtnActionPerformed(evt);
            }
        });

        jPanel3.setBackground(new java.awt.Color(255, 255, 204));
        jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(51, 51, 255), null, null));

        jLabel34.setText("Variables");

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel2)
                    .add(jLabel3)
                    .add(jLabel4)
                    .add(jLabel7)
                    .add(jLabel6)
                    .add(jLabel5)
                    .add(jLabel8)
                    .add(jLabel9)
                    .add(jLabel10)
                    .add(jLabel11)
                    .add(jLabel12)
                    .add(jLabel13)
                    .add(jLabel14)
                    .add(jLabel15)
                    .add(jLabel16)
                    .add(jLabel17)
                    .add(jLabel18)
                    .add(jLabel19)
                    .add(jLabel20)
                    .add(jLabel22)
                    .add(jLabel23)
                    .add(jLabel24)
                    .add(jLabel25)
                    .add(jLabel26)
                    .add(jLabel27)
                    .add(jLabel28)
                    .add(jLabel29)
                    .add(jLabel30)
                    .add(jLabel31)
                    .add(jLabel32)
                    .add(jLabel33)
                    .add(jLabel21)
                    .add(jLabel1)
                    .add(jLabel34))
                .addContainerGap(392, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jLabel34)
                .add(6, 6, 6)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel21)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel2)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel3)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel4)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel5)
                .add(9, 9, 9)
                .add(jLabel6)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel7)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel8)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel9)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel10)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel11)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel12)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel13)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel14)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel15)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel16)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel17)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel18)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel19)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel20)
                .add(26, 26, 26)
                .add(jLabel22)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel23)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel24)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel25)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel26)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel27)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel28)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel29)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel30)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel31)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel32)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel33)
                .addContainerGap(113, Short.MAX_VALUE))
        );
        jScrollPane2.setViewportView(jPanel3);

        jPanel2.setBackground(new java.awt.Color(156, 191, 211));
        jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(0, 51, 255), null, null));
        jPanel2.setForeground(new java.awt.Color(183, 228, 226));

        pymtjLbl.setText("Payment Amount");

        rqstjLbl.setText("Credit Increase");

        descjLbl.setText("Description");

        chrgjBtn.setText("CHARGE");
        chrgjBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chrgjBtnActionPerformed(evt);
            }
        });

        pymtjBtn.setText("PAYMENT");
        pymtjBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pymtjBtnActionPerformed(evt);
            }
        });

        rqstjBtn.setText("REQUEST");
        rqstjBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rqstjBtnActionPerformed(evt);
            }
        });

        jButton1.setText("EXIT");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        chrgjLbl.setText("Charge Amount");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(pymtjLbl)
                    .add(rqstjLbl)
                    .add(chrgjLbl))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(chrgjTxtFld, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .add(pymtjTxtFld)
                    .add(rqstjTxtFld))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(statusjLbl)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(9, 9, 9)
                        .add(descjLbl, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel2Layout.createSequentialGroup()
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(pymtjBtn)
                                    .add(rqstjBtn)))
                            .add(jPanel2Layout.createSequentialGroup()
                                .add(23, 23, 23)
                                .add(descjTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 148, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .add(15, 15, 15)
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(chrgjBtn)
                            .add(jButton1))))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(statusjLbl)
                .add(36, 36, 36)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(chrgjLbl)
                    .add(chrgjTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(descjTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(descjLbl)
                    .add(chrgjBtn))
                .add(17, 17, 17)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(pymtjLbl)
                    .add(pymtjTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(pymtjBtn))
                .add(19, 19, 19)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(rqstjTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(rqstjLbl)
                    .add(rqstjBtn)
                    .add(jButton1))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 21, Short.MAX_VALUE)
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 247, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jRadioButton1)
                            .add(jRadioButton2)))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(173, 173, 173)
                        .add(acctjLbl))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(35, 35, 35)
                                .add(acctheaderjLbl)
                                .add(24, 24, 24)
                                .add(acctNojTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 108, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(jPanel1Layout.createSequentialGroup()
                                .addContainerGap()
                                .add(sum1jLbl)))
                        .add(75, 75, 75)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(10, 10, 10)
                                .add(utilityjBtn, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .add(org.jdesktop.layout.GroupLayout.LEADING, submitjBtn)))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(71, 71, 71)
                        .add(header)))
                .addContainerGap(63, Short.MAX_VALUE))
            .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(header)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jRadioButton1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jRadioButton2)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(acctjLbl)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(acctheaderjLbl)
                            .add(acctNojTxtFld, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(submitjBtn))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(utilityjBtn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(sum1jLbl))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        File.setText("File");
        Credit.setText("Credit");
        Credit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CreditActionPerformed(evt);
            }
        });

        crexistingacct.setText("Existing Account");
        crexistingacct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                crexistingacctActionPerformed(evt);
            }
        });

        Credit.add(crexistingacct);

        crnewacct.setText("New Account");
        crnewacct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                crnewacctActionPerformed(evt);
            }
        });

        Credit.add(crnewacct);

        File.add(Credit);

        Debit.setText("Debit");
        dbexistingacct.setText("Existing Account");
        dbexistingacct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dbexistingacctActionPerformed(evt);
            }
        });

        Debit.add(dbexistingacct);

        dbnewacct.setText("New Account");
        dbnewacct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dbnewacctActionPerformed(evt);
            }
        });

        Debit.add(dbnewacct);

        File.add(Debit);

        jMenuBar2.add(File);

        setJMenuBar(jMenuBar2);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(17, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>                        

    private void utilityjBtnActionPerformed(java.awt.event.ActionEvent evt) {                                            
utility();
    }                                           
        
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        System.exit(0);
    }                                        
    
    private void submitjBtnActionPerformed(java.awt.event.ActionEvent evt) {                                           
        //DebitCard db=new DebitCard(pc.getAccountNo(),pc.getAcctStatusCode(),pc.getAcctTypeCode());
        if(evt.getActionCommand().equals("SUBMIT")){
            submitjBtn.setEnabled(false);
            pc.setAccountNo(Long.parseLong(acctNojTxtFld.getText()));
            //Credit?
            if(pc.getAcctTypeCode().equals("c")){
                try{
                    pc.setData();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                }catch(SQLException ex){
                    ex.printStackTrace();
                }catch(Exception ex){
                    ex.printStackTrace();
                }
                try {
                    creditTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            //Debit?
            if(pc.getAcctTypeCode().equals("d")){
                try{
                    db.setData();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                }catch(SQLException ex){
                    ex.printStackTrace();
                }catch(Exception ex){
                    ex.printStackTrace();
                }
                try {
                    debitTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }                                          
    
    private void chrgjBtnActionPerformed(java.awt.event.ActionEvent evt) {                                         
        pc.setSum1jLbl(evt.getActionCommand().toString());///////delete
        sum1jLbl.setText(pc.getSum1jLbl());/////delete
        if(evt.getActionCommand().equals("CHARGE")){
            pc.setTransval(Double.parseDouble(chrgjTxtFld.getText()));
            pc.setDescription(descjTxtFld.getText());
            // btnSet();
            preAction();
            if(pc.getAcctTypeCode().equals("d")){
                try {
                    debitTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if(pc.getAcctTypeCode().equals("c")){
                try {
                    creditTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }                                        
    
    private void pymtjBtnActionPerformed(java.awt.event.ActionEvent evt) {                                         
        if(evt.getActionCommand().equals("DEPOSIT")||evt.getActionCommand().equals("PAYMENT")){
            pc.setTransval((Double.parseDouble(pymtjTxtFld.getText())*-1));
             
            if(!pymtjTxtFld.getText().equals("")){
                statusjLbl.setText("Enter Amount of PAYMENT");
            }
            pc.setTransdesc("PAYMENT");
            pc.setDescription(pc.getTransdesc());
                preAction();
            if(pc.getAcctTypeCode()==("d")){
                try {
                    debitTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if(pc.getAcctTypeCode().equals("c")){
                try {
                    creditTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }                                        
    
    private void rqstjBtnActionPerformed(java.awt.event.ActionEvent evt) {                                         
        if(evt.getActionCommand()=="REQUEST"){
            btnSet();
            preAction();
            if(pc.getAcctTypeCode().equals("d")){
                try {
                    debitTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if(pc.getAcctTypeCode().equals("c")){
                try {
                    creditTemp();
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }                                        
    
    private void dbnewacctActionPerformed(java.awt.event.ActionEvent evt) {                                          
           jLabel33.setText(evt.getActionCommand());
      
        if(evt.getActionCommand().equals("New Account")){
            pc.setAcctTypeCode("d");//debit
            pc.setAcctStatusCode("n");// new
            btnSet();
            try {
                pc.newAccount();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            acctjLbl.setText("Debit Account: "+String.valueOf(pc.getAccountNo()));
            try {
                 
                db.setData();
               
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }finally{
            }
            try {
                debitTemp();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }                                         
    
    private void dbexistingacctActionPerformed(java.awt.event.ActionEvent evt) {                                               
        if(evt.getActionCommand().equals("Existing Account")){
            pc.setAcctTypeCode("d");//debit
            pc.setAcctStatusCode("e");//existing
            btnSet();
        }
    }                                              
    
    private void crnewacctActionPerformed(java.awt.event.ActionEvent evt) {                                          
        if(evt.getActionCommand()==("New Account")){
            pc.setAcctTypeCode("c");// credit
            pc.setAcctStatusCode("n");//new
            btnSet();
            try {
                pc.newAccount();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            }catch(Exception ex){
                ex.printStackTrace();
            }
            acctjLbl.setText("Credit Account: "+String.valueOf(pc.getAccountNo()));
            try {
                pc.setData();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            try {
                creditTemp();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }                                         
    
    private void crexistingacctActionPerformed(java.awt.event.ActionEvent evt) {                                               
        if(evt.getActionCommand().equals("Existing Account")){
            pc.setAcctTypeCode("c");// credit
            pc.setAcctStatusCode("e");//existing
            btnSet();
        }
    }                                              
    
    private void CreditActionPerformed(java.awt.event.ActionEvent evt) {                                       
// TODO add your handling code here:
    }                                      
    private void creditTemp() throws FileNotFoundException, IOException, SQLException, Exception{
        tempjTxtArea.setText("");
        tempjTxtArea.append("Account Type: " +pc.getAcctType()+"\n");
        tempjTxtArea.append("Account#: "  +(String.valueOf(pc.getAccountNo()))+"\n");
        tempjTxtArea.append("Date: " +(String.valueOf(pc.getDate().toString()))+"\n");
        tempjTxtArea.append("Credit Limit: "  +(String.valueOf(pc.getCreditLimit()))+"\n");
        tempjTxtArea.append("Available Credit: "  +(String.valueOf(pc.getAvailable()))+"\n");
        tempjTxtArea.append("Outstanding Balance: "  +(String.valueOf(pc.getBalance()))+"\n");
        tempjTxtArea.append("Charge: "  +(String.valueOf(pc.getCharge()))+"\n");
        tempjTxtArea.append("Description; "  +pc.getTransdesc()+"\n");
        tempjTxtArea.append("PAYMENT: " +(String.valueOf(pc.getPAYMENT()))+"\n");
        tempjTxtArea.append("Total Charges: "  +(String.valueOf(pc.getTotalCharges()))+"\n");
        tempjTxtArea.append("Total PAYMENTs "  +(String.valueOf(pc.getTotalPAYMENTs()))+"\n");
        tempjTxtArea.append("Interest: " +(String.valueOf(pc.getInterest()))+"\n");
        //tempjTxtArea.append("Transaction (0=Quit, +=$=charge, -$=PAYMENT, 9999=Limit increase): ");
    }
    private void debitTemp()throws FileNotFoundException, IOException, SQLException, Exception{
        tempjTxtArea.setText("");
        tempjTxtArea.append("Account Type: " +db.getAcctType()+"\n");
        tempjTxtArea.append("Date: " +db.getDate()+"\n");
        tempjTxtArea.append("Account Number: "+(String.valueOf(pc.getAccountNo())+"\n"));
        tempjTxtArea.append("Debit Balance: " +(String.valueOf(pc.getBank())+"\n"));
        tempjTxtArea.append("Deposit"+(String.valueOf(pc.getPAYMENT())+"\n"));
        tempjTxtArea.append("Charge: "  + (String.valueOf(pc.getCharge())+"\n"));
        tempjTxtArea.append("Description; "  + pc.getTransdesc()+"\n");
        tempjTxtArea.append("Deposit: " +(String.valueOf(pc.getPAYMENT())+"\n"));
        tempjTxtArea.append("Total Charges: "  +(String.valueOf(pc.getTotalCharges())+"\n"));
        tempjTxtArea.append("Total Deposits "  +(String.valueOf(pc.getTotalPAYMENTs())+"\n"));
        // tempjTxtArea.append("Transaction (0=Quit, +=$=charge, -$=Deposit, -1=view file): ");
    }
    private void preAction(){
        if (pc.getTransval() == 0){
            pc.setStatusjLbl("Enter Charge Amount");
            return;
        }
        if(pc.getDescription().equals("")){
            pc.setStatusjLbl("ENTER DESCRIPTION");
            return;
        }
        if (pc.getTransval() == 9999){
            try {
                pc.creditIncrease();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (pc.getTransval() > 0){
            if(!descjTxtFld.equals("")){
                pc.setTransdesc(descjTxtFld.getText());
            }else{
                statusjLbl.setText("Enter a Description!");
            }
            if(!pc.getTransdesc().equals("")){
                //future manipulation
                pc.setDescription(pc.getTransdesc());
            }else{
                return;
            }
            if(!chrgjTxtFld.equals("")){
                pc.setCharge(pc.getTransval());
            }else{
                statusjLbl.setText("How much!)");
            }
            if(pc.getCharge()>0){
                pc.numchk();
                pc.setAmount(pc.getTransval());
            }else{
                statusjLbl.setText("must be a positive number!");
            }
            try {
                pc.Transaction();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            if(pc.getTransval()==-1){
                return;//////////////pending
            }
        }
        if(pc.getTransval() < 0){
           
            pc.setAmount(pc.getTransval());
            pc.setPAYMENT(pc.getAmount());
            
            // pc.setAvailable(pc.getAvailable()+pc.getPAYMENT());
            try {
                pc.Transaction();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
    }
}
private void btnSet(){
     sum1jLbl.setText(pc.getAcctTypeCode());/////delete
    //existing
    if(pc.getAcctStatusCode().equals("e")){
        //Debit?
        if(pc.getAcctTypeCode().equals("d")){
            tempjTxtArea.setText("");
            acctNojTxtFld.setText("");
            chrgjTxtFld.setText("");
            descjTxtFld.setText("");
            pymtjTxtFld.setText("");
            rqstjTxtFld.setText("");
            submitjBtn.setEnabled(true);
            chrgjBtn.setEnabled(true);
            pymtjBtn.setEnabled(true);
            pymtjBtn.setText("DEPOSIT");
            pymtjLbl.setText("DEPOSIT");
            rqstjBtn.setEnabled(false);
            acctjLbl.setText("ENTER ACCOUNT NUMBER");
            statusjLbl.setText("Charges require a tranasaction description.");
        }
        //Credit?
        if(pc.getAcctTypeCode().equals("c")){
            tempjTxtArea.setText("");
            acctNojTxtFld.setText("");
            chrgjTxtFld.setText("");
            descjTxtFld.setText("");
            pymtjTxtFld.setText("");
            rqstjTxtFld.setText("");
            submitjBtn.setEnabled(true);
            chrgjBtn.setEnabled(true);
            pymtjBtn.setEnabled(true);
            pymtjBtn.setText("PAYMENT");
            pymtjLbl.setText("PAYMENT");
            rqstjBtn.setEnabled(true);
            acctjLbl.setText("ENTER ACCOUNT NUMBER");
            statusjLbl.setText("Charges require a tranasaction description.");
        }
    }
    //New Account?
    if(pc.getAcctStatusCode().equals("n")){
        //debit?
        if(pc.getAcctTypeCode().equals("d")){
             sum1jLbl.setText(pc.getAcctStatusCode());/////delete
            tempjTxtArea.setText("");
            acctNojTxtFld.setText("");
            chrgjTxtFld.setText("");
            descjTxtFld.setText("");
            pymtjTxtFld.setText("");
            rqstjTxtFld.setText("");
            submitjBtn.setEnabled(false);
            chrgjBtn.setEnabled(true);
            pymtjBtn.setEnabled(true);
            pymtjBtn.setText("DEPOSIT");
            pymtjLbl.setText("DEPOSIT");
            rqstjBtn.setEnabled(false);
            acctjLbl.setText("Debit Account: ");
            statusjLbl.setText("Charges require a tranasaction description.");
        }
        //Credit?
        if(pc.getAcctTypeCode().equals("c")){
            tempjTxtArea.setText("");
            acctNojTxtFld.setText("");
            chrgjTxtFld.setText("");
            descjTxtFld.setText("");
            pymtjTxtFld.setText("");
            rqstjTxtFld.setText("");
            submitjBtn.setEnabled(false);
            chrgjBtn.setEnabled(true);
            pymtjBtn.setEnabled(true);
            pymtjBtn.setText("PAYMENT");
            pymtjLbl.setText("PAYMENT");
            rqstjBtn.setEnabled(true);
            acctjLbl.setText("Credit Account");
            statusjLbl.setText("Charges require a tranasaction description.");
        }
    }
}
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new CGui().setVisible(true);
            
        }
    });
}
  ///////////////////////////////////////start UTILITY///////////////////////////////////
        public void utility(){
           
           // jLabel34.setText("Command: "+String.valueOf(evt.getActionCommand()));
           
            jLabel1.setText("AcctTypeCode: "+String.valueOf(pc.getAcctTypeCode()));
            jLabel2.setText("AcctType: "+String.valueOf(pc.getAcctType()));
            jLabel3.setText("AccountNo: "+String.valueOf(pc.getAccountNo()));
            jLabel4.setText("Date: "+String.valueOf(pc.getDate()));
            jLabel5.setText("Amount: "+String.valueOf(pc.getAmount()));
            jLabel6.setText("Bank: "+String.valueOf(pc.getBank()));
            jLabel7.setText("PAYMENT: "+String.valueOf(pc.getPAYMENT()));
            jLabel8.setText("CreditLimit: "+String.valueOf(pc.getCreditLimit()));
            jLabel9.setText("TotalCharges: "+String.valueOf(pc.getTotalCharges()));
            jLabel10.setText("Description: "+String.valueOf(pc.getDescription()));
            jLabel11.setText("TotalPAYMENTs: "+String.valueOf(pc.getTotalPAYMENTs()));
            jLabel12.setText("Available: "+String.valueOf(pc.getAvailable()));
            jLabel13.setText("Balance: "+String.valueOf(pc.getBalance()));
            jLabel14.setText("Charge: "+String.valueOf(pc.getCharge()));
            jLabel15.setText("Transdesc: "+String.valueOf(pc.getTransdesc()));
            jLabel16.setText("Status: "+String.valueOf(pc.getStatus()));
            jLabel17.setText("StatusFileString: "+String.valueOf(pc.getStatusFileString()));
            jLabel18.setText("getStatusFile: "+String.valueOf(pc.getStatusFile()));
            jLabel19.setText("LogFileString: "+String.valueOf(pc.getLogFileString()));
            jLabel20.setText("LogFile: "+String.valueOf(pc.getLogFile()));
            jLabel21.setText("AcctStatusCode: "+String.valueOf(pc.getAcctStatusCode()));
            jLabel22.setText("StatusFileName: "+String.valueOf(pc.getStatusFileName()));
            jLabel23.setText("LogFileName: "+String.valueOf(pc.getLogFileName()));
            jLabel24.setText("LogFilePath: "+String.valueOf(pc.getLogFilePath()));
            jLabel25.setText("StatusFilePath: "+String.valueOf(pc.getStatusFilePath()));
            jLabel26.setText("StatusFile: "+String.valueOf(pc.getStatusFile()));
            jLabel27.setText("Rate: "+String.valueOf(pc.getRate()));
            jLabel28.setText("Interest: "+String.valueOf(pc.getInterest()));
            jLabel29.setText("StatusjLbl: "+String.valueOf(pc.getStatusjLbl()));
            jLabel30.setText("TransResult: "+String.valueOf(pc.getTransResult()));
            jLabel31.setText("TransErr: "+String.valueOf(pc.getTransErr()));
           
        }
            
            /////////////////////////////////////////////end UTILITY////////////////////////////////////
            
            

            

public void actionPerformed(ActionEvent e) {
}
    // Variables declaration - do not modify                     
    private javax.swing.JMenu Credit;
    private javax.swing.JMenu Debit;
    private javax.swing.JMenu File;
    private javax.swing.JTextField acctNojTxtFld;
    private javax.swing.JLabel acctheaderjLbl;
    private javax.swing.JLabel acctjLbl;
    private javax.swing.JButton chrgjBtn;
    private javax.swing.JLabel chrgjLbl;
    private javax.swing.JTextField chrgjTxtFld;
    private javax.swing.JMenuItem crexistingacct;
    private javax.swing.JMenuItem crnewacct;
    private javax.swing.JMenuItem dbexistingacct;
    private javax.swing.JMenuItem dbnewacct;
    private javax.swing.JLabel descjLbl;
    private javax.swing.JTextField descjTxtFld;
    private javax.swing.JLabel header;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton pymtjBtn;
    private javax.swing.JLabel pymtjLbl;
    private javax.swing.JTextField pymtjTxtFld;
    private javax.swing.JButton rqstjBtn;
    private javax.swing.JLabel rqstjLbl;
    private javax.swing.JTextField rqstjTxtFld;
    private javax.swing.JLabel statusjLbl;
    private javax.swing.JButton submitjBtn;
    private javax.swing.JLabel sum1jLbl;
    private javax.swing.JTextArea tempjTxtArea;
    private javax.swing.JButton utilityjBtn;
    // End of variables declaration                   
    
}
/*
 * DebitCard.java
 *
 * Created on October 5, 2007, 8:10 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package creditcard;
import creditcard.ProcessCard;
import creditcard.CGui;
import java.awt.TextField;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
import tio.FormattedWriter;
public class DebitCard extends ProcessCard{
    private String s;
    private File file;
    private ProcessCard pc;
    private CGui gui;
    DebitCard(){
        super();
    }
   public void setData()throws FileNotFoundException, IOException, SQLException, Exception{
        //debit?
        if(getAcctTypeCode()=="d"){
            
          if(getStatusFileName().equals("DC_Num_status.txt")){
              System.exit(0);
          }
          if(getSum1jLbl().equals("d")){
              System.exit(0);
          }
            setAcctType("Debit");
            setCreditLimit(20000);
            setBank(getCreditLimit());
            setTotalCharges(0);
            setTotalPAYMENTs(0);
            setStatusFileName("DC_Num_status.txt");
            if(getStatusFileName().equals("DC_Num_status.txt"));
            File StatusFile = new File(getStatusFileName());
            setStatusFile(StatusFile);
            setStatusFilePath(StatusFile.getAbsolutePath());
            setLogFileName("DC" + getAccountNo() + ".txt");
            File LogFile = new File(getLogFileName());
            setLogFile(LogFile);
            setLogFilePath(LogFile.getAbsolutePath());
            Date Date = new Date();
            Date.getTime();
            setDate(Date.toString());
            writeLog(getLogFile());
            accountStatus(getStatusFileName());
        }
    }
    
    private void Available() {
        if(getAmount()>0){
            setBank(getBank()-getAmount());
        }
        if(getAmount()<0){
            setBank(getBank()-getAmount());
        }
    }
    private void accountStatus(String s) throws IOException, SQLException, Exception{
        this.s=s;
        FormattedWriter fw = new FormattedWriter(new FileWriter(s));
        fw.printfln("Account Type: "+getAcctType());
        fw.printfln("Account: " +getAccountNo());
        fw.printfln("Date: " +getDate());
        fw.printfln("Credit Limit: " +getCreditLimit());
        fw.printfln("Available Credit: " +getAvailable());
        fw.printfln("Outstanding Balance: " +getBalance());
        fw.printfln("Last Transaction was a " +getDescription()+ "of:  $" +getCharge() + " on " +getDate());
        fw.printfln("Total Charges: " +getTotalCharges());
        fw.printfln("Total PAYMENTs " +getTotalPAYMENTs());
        fw.printfln("Interest: " + getInterest());
    }
    private void writeLog(File file) throws FileNotFoundException, IOException, SQLException, Exception {
        this.file=file;
        FormattedWriter out = new FormattedWriter(new FileWriter(file,true));
        out.println(getDate());
        out.printfln(getAcctType());
        out.printfln(getAccountNo());
        out.printfln(getAvailable());
        out.printfln(getTotalCharges());
        out.printfln(getTotalPAYMENTs());
        if(getDescription()=="PAYMENT"){
            setCharge(0);
        }else{
            out.printf(getInterest());
            setPAYMENT(0);
        }
        out.printfln(getCharge());
        out.printfln(getPAYMENT());
        out.println(getDescription());
    }
}
/*
 * ProcessCard.java
 *
 * Created on September 29, 2007, 11:53 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package creditcard;
import creditcard.DebitCard;
import creditcard.CGui;
import java.awt.TextField;
import tio.*;
import java.lang.Object.*;
import java.io.*;
import java.sql.*;
import java.util.Date;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.sql.SQLException;
public class ProcessCard {
    private CGui gui;
    private TextField temptxtarea;
    private long AccountNo;
    private double CreditLimit;
    private double PAYMENT;
    private double TotalCharges;
    private double TotalPAYMENTs;
    private double Amount;
    private double Charge;
    private double Available;
    private double Balance;
    private String Date;
    private String Description;
    private String AcctTypeCode;
    private String AcctStatusCode;
    private int Inval;
    private double Transval;
    private double Bank;
    private double increase=100;
    private String AcctType;
    private String Transdesc;
    private String s;
    private FormattedWriter out;
    private String StatusFileString;
    private String LogFileString;
    private File StatusFile;
    private File LogFile;
    private String LogFileName;
    private String LogFilePath;
    private File file;
    private String StatusFileName;
    private String getLogFileString;
    private String Status;
    private String StatusFilePath;
    private File f;
    private Statement stm = null;
    private ResultSet rst = null;
    private String tableName = "acctdata";
    private String query;
    private int TransResult;
    private String TransErr;
    private double Rate=.067586582;
    private double Interest;
    private String StatusjLbl;
    public String sum1jLbl;
    public double sum2jLbl;
    public void setData() throws FileNotFoundException, IOException, SQLException, Exception{
        if(getAcctTypeCode().equals("c")){
            setAcctType("Credit");
            setCreditLimit(1000);
            setTotalCharges(0);
            setTotalPAYMENTs(0);
            setStatusFileName("CC_Num_status.txt");
            File StatusFile = new File(getStatusFileName());
            setStatusFile(StatusFile);
            setStatusFilePath(StatusFile.getAbsolutePath());
            setLogFileName("CC" + getAccountNo() + ".txt");
            File LogFile = new File(getLogFileName());
            setLogFile(LogFile);
            setLogFilePath(LogFile.getAbsolutePath());
            Date Date = new Date();
            Date.getTime();
            setDate(Date.toString());
            Available();
            Balance();
            writeLog(getLogFile());
            accountStatus(getStatusFileName());
        }
        if(getAcctTypeCode().equals("x")){
            System.exit(0);
        }
    }
    final void newAccount() throws FileNotFoundException, IOException {
        double r = Math.random();
        long x = (long)(r * 100000000);
        setAccountNo(x);
    }
    final void creditIncrease()throws FileNotFoundException, IOException, SQLException, Exception{
        TransResult = 0;
        if (Math.random() > .25) {
            CreditLimit += increase;
            setCreditLimit(CreditLimit);
            setDescription("Creditlimit increase of: $" +increase);
            System.out.println("Creditlimit increase of: $" +increase);
            accountStatus(StatusFileName);
        } else {
            setDescription("Creditlimit increase denied: " +Date);
            System.out.println("Sorry, credit increase not possible at this time.");
            TransResult = 1;
            accountStatus(StatusFileName);
        }
    }
    private void TotalPayments(){
        setTotalPAYMENTs(getTotalPAYMENTs()+getPAYMENT());
    }
    private void TotalCharges(){
        setTotalCharges(getTotalCharges()+getCharge());
    }
    private void Available() {
        setAvailable(getCreditLimit() - ( getTotalCharges() - getTotalPAYMENTs() ));
    }
    private void Balance() {
        setBalance(getTotalCharges() - getTotalPAYMENTs());
    }
    private void Interest() {
        setInterest(getTotalCharges()*getRate());
    }
    public void Transaction() throws FileNotFoundException, IOException, SQLException, Exception {
        TransResult = 0;
        if ( getAmount() == 0 ) {
            TransResult = 1;
            TransErr = "Transaction amount is 0.";
            return;
        }
        if ( getAmount() > getAvailable() ) {
            TransResult = 1;
            TransErr = "Transaction amount of $" + getAmount() + " has exceeded the available credit limit $" + getAvailable();				Available();
            return;
        }
        if ( getDescription() == "" ) {
            TransResult = 1;
            setStatusjLbl("No transaction description entered.");
            return;
        }
        if ( getAmount() > 0 ) {
            setCharge(getAmount());
            TotalCharges();
            Balance();
            Available();
            Interest();
            accountStatus(getStatusFileName());
            writeLog(getLogFile());
        }
        if ( getAmount() < 0 ) {
            
            setPAYMENT(-1*getAmount());
            if(getPAYMENT()<0){
                return;
            }
            
            TotalPayments();
            Balance();
            Available();
            Interest();
            accountStatus(getStatusFileName());
            writeLog(getLogFile());
        }
    }
    private void accountStatus(String s) throws IOException, SQLException, Exception{
        this.s=s;
        FormattedWriter fw = new FormattedWriter(new FileWriter(s));
        fw.printfln("Account Type: "+getAcctType());
        fw.printfln("Account: " +getAccountNo());
        fw.printfln("Date: " +getDate());
        fw.printfln("Credit Limit: " +getCreditLimit());
        fw.printfln("Available Credit: " +getAvailable());
        fw.printfln("Outstanding Balance: " +getBalance());
        fw.printfln("Last Transaction was a " +getDescription()+ "of:  $" +getCharge() + " on " +getDate());
        fw.printfln("Total Charges: " +getTotalCharges());
        fw.printfln("Total PAYMENTs " +getTotalPAYMENTs());
        fw.printfln("Interest: " +getInterest());
    }
    private void writeLog(File file) throws FileNotFoundException, IOException, SQLException, Exception {
        this.file=file;
        FormattedWriter out = new FormattedWriter(new FileWriter(file,true));
        out.println(getDate());
        out.printfln(getAcctType());
        out.printfln(getAccountNo());
        out.printfln(getAvailable());
        out.printfln(getTotalCharges());
        out.printfln(getTotalPAYMENTs());
        if(getDescription()=="PAYMENT"){
            setCharge(0);
        }else{
            out.printf(Interest);
            setPAYMENT(0);
        }
        out.printfln(getCharge());
        out.printfln(getPAYMENT());
        out.println(getDescription());
    }
    String getAcctTypeCode() {
        return AcctTypeCode;
    }
    void setAcctTypeCode(String AcctTypeCode){
        this.AcctTypeCode=AcctTypeCode;
    }
    void setAcctType(String AcctType){
        this.AcctType=AcctType;
    }
    String getAcctType(){
        return AcctType;
    }
    long getAccountNo(){
        return AccountNo;
    }
    String getDate() {
        return Date;
    }
    void setDate(String Date) {
        this.Date=Date;
    }
    double getAmount(){
        return Amount;
    }
    double getBank(){
        return Bank;
    }
    double getPAYMENT(){
        return PAYMENT;
    }
    double getCreditLimit(){
        return CreditLimit;
    }
    
    double getTotalCharges() {
        return TotalCharges;
    }
    
    String getDescription() {
        return Description;
    }
    
    double getTotalPAYMENTs() {
        return TotalPAYMENTs;
    }
    double getAvailable(){
        return Available;
    }
    double getBalance(){
        return Balance;
    }
    double getCharge() {
        return Charge;
    }
    void setAccountNo(long AccountNo) {
        this.AccountNo=AccountNo;
    }
    
    void setAmount(double Amount){
        this.Amount=Amount;
    }
    void setBank(double Bank){
        this.Bank=Bank;
    }
    void setPAYMENT(double PAYMENT){
        this.PAYMENT=PAYMENT;
    }
    void setCreditLimit(double CreditLimit){
        this.CreditLimit=CreditLimit;
    }
    
    void setTotalCharges(double TotalCharges) {
        this.TotalCharges=TotalCharges;
    }
    
    void setDescription(String Description) {
        this.Description=Description;
    }
    
    void setTotalPAYMENTs(double TotalPAYMENTs) {
        this.TotalPAYMENTs=TotalPAYMENTs;
    }
    
    void setAvailable(double Available) {
        this.Available=Available;
    }
    
    void setBalance(double Balance) {
        this.Balance=Balance;
    }
    void setCharge(double Charge){
        this.Charge=Charge;
    }
    
    void setTransval(double Transval) {
        this.Transval=Transval;
    }
    double getTransval() {
        return Transval;
    }
    void setTransdesc(String Transdesc) {
        this.Transdesc=Transdesc;
    }
    String getTransdesc() {
        return Transdesc;
    }
    
    void setStatus(String Status){
        this.StatusFileString=StatusFileString;
    }
    String getStatus(){
        return Status;
    }
    
    void setStatusFileString(String StatusFileString) {
        this.StatusFileString=StatusFileString;
    }
    String getStatusFileString(){
        return StatusFileString;
    }
    void setStatusFile(File StatusFile) {
        this.StatusFile=StatusFile;
    }
    File getStatusFile(File StatusFile){
        return StatusFile;
    }
    void setLogFileString(String LogFileString){
        this.LogFileString=LogFileString;
    }
    String getLogFileString(){
        return LogFileString;
    }
    void setLogFile(File LogFile){
        this.LogFile=LogFile;
    }
    File getLogFile(){
        return LogFile;
    }
    
    void setAcctStatusCode(String AcctStatusCode){
        this.AcctStatusCode=AcctStatusCode;
    }
    String getAcctStatusCode(){
        return AcctStatusCode;
    }
    
    void setStatusFileName( String StatusFileName) {
        this.StatusFileName=StatusFileName;
    }
    String getStatusFileName(){
        return StatusFileName;
    }
    void setLogFileName( String LogFileName) {
        this.LogFileName=LogFileName;
    }
    String getLogFileName(){
        return LogFileName;
    }
    void setLogFilePath(String LogFilePath) {
        this.LogFilePath = LogFilePath;
    }
    String getLogFilePath() {
        return LogFilePath;
    }
    
    void setStatusFilePath(String StatusFilePath) {
        this.StatusFilePath=StatusFilePath;
    }
    String getStatusFilePath(){
        return StatusFilePath;
    }
    File getStatusFile() {
        return StatusFile;
    }
    void setRate(double Rate){
        this.Rate=Rate;
    }
    double getRate() {
        return Rate;
    }
    void setInterest(double Interest) {
        this.Interest=Interest;
    }
    double getInterest(){
        return Interest;
    }
    
    void setStatusjLbl(String StatusjLbl) {
        this.StatusjLbl=StatusjLbl;
    }
    String getStatusjLbl(){
        return StatusjLbl;
    }
    void setTransResult(int TransResult){
        this.TransResult=TransResult;
    }
    int getTransResult(){
        return TransResult;
    }
    void setTransErr(String TransErr){
        this.TransErr=TransErr;
    }
    String getTransErr(){
        return TransErr;
    }
    
    void numchk() {
        return;
    }
    
    void setSum1jLbl(String sum1jLbl) {
        this.sum1jLbl=sum1jLbl;
    }
    String getSum1jLbl(){
        return sum1jLbl;
    }
    
    void setSum2jLbl(double sumjLbl) {
        this.sum2jLbl=sumjLbl;
    }
    double getSum2jLbl(){
        return sum2jLbl;
    }
}

I will go thru and add comments I guess. If you were to run the program.creditcard processes work and debit card uses creditcard"

public DebitCard{
super();
}

but when I try the same process using DebitCard all the variables remain set for creditcard.
well thanks any way. I'll work on it some more.

I will go thru and add comments I guess. If you were to run the program.creditcard processes work and debit card uses creditcard"

public DebitCard{
super();
}

but when I try the same process using DebitCard all the variables remain set for creditcard.
well thanks any way. I'll work on it some more.

Do you actually create a DebitCard object to perform the operations on? It sounds like you are still calling methods against a CreditCard object.

You should consider trying to use full, descriptive names for your variables and methods, rather than cryptic abbreviations. I thought this was touched on in the coding conventions, but looking back I don't see it and must be thinking of a different document. Clear names that spell out the intent of a variable or method will help not only other readers of your code, but you as well. It's much easier to organize your thoughts when the intent of the code is clearly spelled out by variables and methods.

Yes. I agree. From now on I plan to do exac tly that. This program is doing just what you explained. But when I click in the file menu "debit","new account" it is listening
and calls debitnewAccount Or (dbnewacctActionPerformed())

 private void dbnewacctActionPerformed(java.awt.event.ActionEvent evt) {                                          
           jLabel33.setText(evt.getActionCommand());

        if(evt.getActionCommand().equals("New Account")){
            pc.setAcctTypeCode("d");//debit
            pc.setAcctStatusCode("n");// new
            btnSet();
            try {
                pc.newAccount();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            acctjLbl.setText("Debit Account: "+String.valueOf(pc.getAccountNo()));
            try {

                db.setData();

            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }finally{
            }
            try {
                debitTemp();
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }     

first it sets all the buttons and textboxes with

btnSet();

then

pc.newAccount();

this works fine it creates an new account no
but it need to set new data in

db.setData();

there is a similar metod used for credit card processe in creditcard class called

setData();

and these variables should be chaned by db.setData but they don't
then it calls debitTemp()which outputs it to the gui.

if i could clidk the menu item debt then new account and have it set data with the DebitCard.java using db.setData(); the rest of the program would work.

I just can't figure the simplest thing "Creating a Debit card .java object that uses the methods of it's parent CreditCard.java but sets the variables relative to debit card.

Edited 3 Years Ago by Dani: Formatting fixed

"pc" is a ProcessCard object. newAccount() is just changing the account number - it is not creating a new object. To do that you need to set pc = new DebitCard(); That will create a DebitCard object, which inherits from the ProcessCard. Unless you need to call a method that is specific to the DebitCard class, you can still use the debit card object by it's ProcessCard base class interface.

That looks really cool (totally new concept)lol
I will definately try that tonight. Thanks If you don't mind tomorrow I will tell you if it worked.

That looks really cool (totally new concept)lol
I will definately try that tonight. Thanks If you don't mind tomorrow I will tell you if it worked.

You might want to check out this book sometime: Head First Java

From what I have heard, it covers a lot of these object-oriented design topics very well. It was listed in a semi-recent "Top Java Books" posting over in JavaLobby and seems to be well-regarded. I've not read that one myself, but I was very impressed with the "Head First Design Patterns" book, which shares a couple of authors and the same presentation style.

Comments
outStanding!

You might want to check out this book sometime: Head First Java

From what I have heard, it covers a lot of these object-oriented design topics very well. It was listed in a semi-recent "Top Java Books" posting over in JavaLobby and seems to be well-regarded. I've not read that one myself, but I was very impressed with the "Head First Design Patterns" book, which shares a couple of authors and the same presentation style.

I couldn't apply that pc=new DebitCard(); concept. Maybe I put it in the wrong place. I still can't figure this out.

I couldn't apply that pc=new DebitCard(); concept. Maybe I put it in the wrong place. I still can't figure this out.

Hey Thanks.
(pc=new DebitCard)
That actually worked great.
I'm back in the game. I just have to put the pollishing touches in the program.

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