Getting an abstract class working

Simply put, something is going wrong with my abstract class, now my assignArray method wont work and my frame wont compile at all anymore.
import javax.swing.*;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.*;
import java.text.DecimalFormat;
public abstract class bankPresentation extends JFrame implements ActionListener {
     //define the frame properties
     private static final int FRAME_WIDTH = 300;
     private static final int FRAME_HEIGHT = 600;
     private static final int FRAME_X_ORIGIN = 150;
     private static final int FRAME_Y_ORIGIN = 250;
     private static final int BUTTON_WIDTH = 80;
     private static final int BUTTON_HEIGHT = 30;
     //define all the frame elements
     JRadioButton depositRadioButton = new JRadioButton("Deposit");
     JRadioButton withdrawRadioButton = new JRadioButton("Withdraw");
     ButtonGroup bankButtonGroup = new ButtonGroup();
     JLabel amountLabel;
     JTextField amountField;
     JTextArea textArea;
     JScrollPane textBoxScroll;
     JButton newAccountButton;
     JButton summaryButton;
     JButton depositWithdrawButton;
     double initialAmountDouble;
     DecimalFormat formatDecimal = new DecimalFormat("$0.00");
     //create a new array, size is 10
     bankSummary customerList[] = new bankSummary[10];
     public static void main(String[] args) {
          bankPresentation frame = new bankPresentation();
          frame.setVisible(true);
     public bankPresentation() {
          Container contentPane;
          //create the deposit and withdraw radio buttons, put them in a group
          //and add them to the frame
          bankButtonGroup.add(depositRadioButton);
          bankButtonGroup.add(withdrawRadioButton);
          setSize(FRAME_WIDTH, FRAME_HEIGHT);
          setResizable(false);
          setTitle("Ch13 Project");
          setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
          contentPane = getContentPane();
          contentPane.setLayout(new FlowLayout());
          contentPane.add(withdrawRadioButton);
          contentPane.add(depositRadioButton);
          //add a large text area to the pane
          textArea = new JTextArea();
          textArea.setColumns(25);
          textArea.setRows(20);
          textArea.setLineWrap(true);
          textBoxScroll = new JScrollPane(textArea);
          textBoxScroll
                    .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          textArea.setBorder(BorderFactory.createLineBorder(Color.RED));
          // Set to non edit
          textArea.setEditable(false);
          contentPane.add(textBoxScroll);
          //create new buttons to create accounts, deposit/withdraw with existing ones, and
          //get a statement with existing ones
          newAccountButton = new JButton("Create Account");
          newAccountButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
          contentPane.add(newAccountButton);
          summaryButton = new JButton("Summary");
          summaryButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
          contentPane.add(summaryButton);
          depositWithdrawButton = new JButton("Deposit/Withdraw");
          depositWithdrawButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
          contentPane.add(depositWithdrawButton);
          //add actionlisteners to all buttons
          summaryButton.addActionListener(this);
          newAccountButton.addActionListener(this);
          depositRadioButton.addActionListener(this);
          withdrawRadioButton.addActionListener(this);
          depositWithdrawButton.addActionListener(this);
          //initialize the array with some existing accounts
          assignArray();
      abstract void assignArray() {
          for (int i = 0; i < customerList.length; i++) {
               customerList[i] = new bankSummary();
          customerList[0].setValues("Bob", "Ghost", "1234", "Savings", 500);
          customerList[1].setValues("Joe", "Shmo", "1333", "Checking", 600);
          customerList[2].setValues("Jack", "Biggs", "9023", "Savings", 200);
     public void actionPerformed(ActionEvent event) {
          int arrayIndexInt = 3;
          // Determine source of event
          Object sourceObject = event.getSource();
          //if a new account is created, ask for first name, last name, pin number, and whether it
          //be a checking or savings account, and the initial amount you're depositing
          if (sourceObject == newAccountButton) {
               String fNameString = JOptionPane.showInputDialog("First Name: ");
               String lNameString = JOptionPane.showInputDialog("Last Name: ");
               String pinString = JOptionPane
                         .showInputDialog("Desired Pin Number: ");
               String accountType = JOptionPane
                         .showInputDialog("Checking or Savings Account? Enter (Checking or Savings)");
               String initialAmountStr = JOptionPane
                         .showInputDialog("Initial Deposit Amount: ");
               double initialAmountDouble = Double.parseDouble(initialAmountStr);
               customerList[arrayIndexInt].setValues(fNameString, lNameString,
                         pinString, accountType, initialAmountDouble);
               arrayIndexInt += 1;
               JOptionPane.showMessageDialog(null, "Account Created!");
          //if the summary button is pressed, ask for the first name on the account
          //then ask for the pin, display the balance for that said account
          if (sourceObject == summaryButton) {
               String nameVerifyStr = JOptionPane
                         .showInputDialog("Firstname on Account: ");
               String pinVerifyStr = JOptionPane.showInputDialog("Pin Number: ");
               if (nameVerifyStr.equals(customerList[0].getFirstName())
                         && pinVerifyStr.equals(customerList[0].getPin())) {
                    textArea.append("Customer: " + customerList[0].getFirstName()
                              + " " + customerList[0].getLastName() + "\nAccount: "
                              + customerList[0].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[0].getBalance()));
               if (nameVerifyStr.equals(customerList[1].getFirstName())
                         && pinVerifyStr.equals(customerList[1].getPin())) {
                    textArea.append("Customer: " + customerList[1].getFirstName()
                              + " " + customerList[1].getLastName() + "\nAccount: "
                              + customerList[1].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[1].getBalance()));
               if (nameVerifyStr.equals(customerList[2].getFirstName())
                         && pinVerifyStr.equals(customerList[2].getPin())) {
                    textArea.append("Customer: " + customerList[2].getFirstName()
                              + " " + customerList[2].getLastName() + "\nAccount: "
                              + customerList[2].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[2].getBalance()));
               if (nameVerifyStr.equals(customerList[3].getFirstName())
                         && pinVerifyStr.equals(customerList[3].getPin())) {
                    textArea.append("Customer: " + customerList[3].getFirstName()
                              + " " + customerList[3].getLastName() + "\nAccount: "
                              + customerList[3].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[3].getBalance()));
               if (nameVerifyStr.equals(customerList[4].getFirstName())
                         && pinVerifyStr.equals(customerList[4].getPin())) {
                    textArea.append("\nCustomer: " + customerList[4].getFirstName()
                              + " " + customerList[4].getLastName() + "\nAccount: "
                              + customerList[4].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[4].getBalance()));
               if (nameVerifyStr.equals(customerList[5].getFirstName())
                         && pinVerifyStr.equals(customerList[5].getPin())) {
                    textArea.append("\nCustomer: " + customerList[5].getFirstName()
                              + " " + customerList[5].getLastName() + "\nAccount: "
                              + customerList[5].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[5].getBalance()));
               if (nameVerifyStr.equals(customerList[6].getFirstName())
                         && pinVerifyStr.equals(customerList[6].getPin())) {
                    textArea.append("\nCustomer: " + customerList[6].getFirstName()
                              + " " + customerList[6].getLastName() + "\nAccount: "
                              + customerList[6].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[6].getBalance()));
               if (nameVerifyStr.equals(customerList[7].getFirstName())
                         && pinVerifyStr.equals(customerList[7].getPin())) {
                    textArea.append("\nCustomer: " + customerList[7].getFirstName()
                              + " " + customerList[7].getLastName() + "\nAccount: "
                              + customerList[7].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[7].getBalance()));
               if (nameVerifyStr.equals(customerList[8].getFirstName())
                         && pinVerifyStr.equals(customerList[8].getPin())) {
                    textArea.append("\nCustomer: " + customerList[8].getFirstName()
                              + " " + customerList[8].getLastName() + "\nAccount: "
                              + customerList[8].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[8].getBalance()));
               if (nameVerifyStr.equals(customerList[9].getFirstName())
                         && pinVerifyStr.equals(customerList[9].getPin())) {
                    textArea.append("\nCustomer: " + customerList[9].getFirstName()
                              + " " + customerList[9].getLastName() + "\nAccount: "
                              + customerList[9].getAccountType() + "\nBalance: "
                              + formatDecimal.format(customerList[9].getBalance()));
               textArea.append("\n===========================");
          //if the deposit/withdraw button is pressed, ask how much to deposit or withdraw
          //depending on which radio button is selected
          //Verify the name and pin on the account
          if (sourceObject == depositWithdrawButton) {
               String nameVerifyStr = JOptionPane
                         .showInputDialog("Firstname on Account: ");
               String pinVerifyStr = JOptionPane.showInputDialog("Pin Number: ");
               if (depositRadioButton.isSelected()) {
                    String depositAmountStr = JOptionPane
                              .showInputDialog("Deposit Amount: ");
                    double depositAmountDouble = Double
                              .parseDouble(depositAmountStr);
                    if (nameVerifyStr.equals(customerList[0].getFirstName())
                              && pinVerifyStr.equals(customerList[0].getPin())) {
                         double balanceDouble = customerList[0].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[0].setValues(customerList[0].getFirstName(),
                                   customerList[0].getLastName(), customerList[0]
                                             .getPin(),
                                   customerList[0].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[0].getFirstName() + " "
                                   + customerList[0].getLastName() + "\nAccount: "
                                   + customerList[0].getAccountType() + "\nPin: "
                                   + customerList[0].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[1].getFirstName())
                              && pinVerifyStr.equals(customerList[1].getPin())) {
                         double balanceDouble = customerList[1].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[1].setValues(customerList[1].getFirstName(),
                                   customerList[1].getLastName(), customerList[1]
                                             .getPin(),
                                   customerList[1].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[1].getFirstName() + " "
                                   + customerList[1].getLastName() + "\nAccount: "
                                   + customerList[1].getAccountType() + "\nPin: "
                                   + customerList[1].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[2].getFirstName())
                              && pinVerifyStr.equals(customerList[2].getPin())) {
                         double balanceDouble = customerList[2].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[2].setValues(customerList[2].getFirstName(),
                                   customerList[2].getLastName(), customerList[2]
                                             .getPin(),
                                   customerList[2].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[2].getFirstName() + " "
                                   + customerList[2].getLastName() + "\nAccount: "
                                   + customerList[2].getAccountType() + "\nPin: "
                                   + customerList[2].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[3].getFirstName())
                              && pinVerifyStr.equals(customerList[3].getPin())) {
                         double balanceDouble = customerList[3].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[3].setValues(customerList[3].getFirstName(),
                                   customerList[3].getLastName(), customerList[3]
                                             .getPin(),
                                   customerList[3].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[3].getFirstName() + " "
                                   + customerList[3].getLastName() + "\nAccount: "
                                   + customerList[3].getAccountType() + "\nPin: "
                                   + customerList[3].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[4].getFirstName())
                              && pinVerifyStr.equals(customerList[4].getPin())) {
                         double balanceDouble = customerList[4].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[4].setValues(customerList[4].getFirstName(),
                                   customerList[4].getLastName(), customerList[4]
                                             .getPin(),
                                   customerList[4].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[4].getFirstName() + " "
                                   + customerList[4].getLastName() + "\nAccount: "
                                   + customerList[4].getAccountType() + "\nPin: "
                                   + customerList[4].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[5].getFirstName())
                              && pinVerifyStr.equals(customerList[5].getPin())) {
                         double balanceDouble = customerList[5].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[5].setValues(customerList[5].getFirstName(),
                                   customerList[5].getLastName(), customerList[5]
                                             .getPin(),
                                   customerList[5].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[5].getFirstName() + " "
                                   + customerList[5].getLastName() + "\nAccount: "
                                   + customerList[5].getAccountType() + "\nPin: "
                                   + customerList[5].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[6].getFirstName())
                              && pinVerifyStr.equals(customerList[6].getPin())) {
                         double balanceDouble = customerList[6].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[6].setValues(customerList[6].getFirstName(),
                                   customerList[6].getLastName(), customerList[6]
                                             .getPin(),
                                   customerList[6].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[6].getFirstName() + " "
                                   + customerList[6].getLastName() + "\nAccount: "
                                   + customerList[6].getAccountType() + "\nPin: "
                                   + customerList[6].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[7].getFirstName())
                              && pinVerifyStr.equals(customerList[7].getPin())) {
                         double balanceDouble = customerList[7].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[7].setValues(customerList[7].getFirstName(),
                                   customerList[7].getLastName(), customerList[7]
                                             .getPin(),
                                   customerList[7].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[7].getFirstName() + " "
                                   + customerList[7].getLastName() + "\nAccount: "
                                   + customerList[7].getAccountType() + "\nPin: "
                                   + customerList[7].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[8].getFirstName())
                              && pinVerifyStr.equals(customerList[8].getPin())) {
                         double balanceDouble = customerList[8].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[8].setValues(customerList[8].getFirstName(),
                                   customerList[8].getLastName(), customerList[8]
                                             .getPin(),
                                   customerList[8].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[8].getFirstName() + " "
                                   + customerList[8].getLastName() + "\nAccount: "
                                   + customerList[8].getAccountType() + "\nPin: "
                                   + customerList[8].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[9].getFirstName())
                              && pinVerifyStr.equals(customerList[9].getPin())) {
                         double balanceDouble = customerList[9].getBalance();
                         balanceDouble += depositAmountDouble;
                         customerList[9].setValues(customerList[9].getFirstName(),
                                   customerList[9].getLastName(), customerList[9]
                                             .getPin(),
                                   customerList[9].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[9].getFirstName() + " "
                                   + customerList[9].getLastName() + "\nAccount: "
                                   + customerList[9].getAccountType() + "\nPin: "
                                   + customerList[9].getPin() + "\nChanges: +"
                                   + depositAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
               if (withdrawRadioButton.isSelected()) {
                    String withdrawAmountStr = JOptionPane
                              .showInputDialog("Withdraw Amount: ");
                    double withdrawAmountDouble = Double
                              .parseDouble(withdrawAmountStr);
                    double chargeDouble;
                    if (withdrawAmountDouble > 2000) {
                         chargeDouble = 0.75;
                    } else if (withdrawAmountDouble > 750) {
                         chargeDouble = 0.50;
                    } else {
                         chargeDouble = 0;
                    if (nameVerifyStr.equals(customerList[0].getFirstName())
                              && pinVerifyStr.equals(customerList[0].getPin())) {
                         double balanceDouble = customerList[0].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[0].setValues(customerList[0].getFirstName(),
                                   customerList[0].getLastName(), customerList[0]
                                             .getPin(),
                                   customerList[0].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[0].getFirstName() + " "
                                   + customerList[0].getLastName() + "\nAccount: "
                                   + customerList[0].getAccountType() + "\nPin: "
                                   + customerList[0].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[1].getFirstName())
                              && pinVerifyStr.equals(customerList[1].getPin())) {
                         double balanceDouble = customerList[1].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[1].setValues(customerList[1].getFirstName(),
                                   customerList[1].getLastName(), customerList[1]
                                             .getPin(),
                                   customerList[1].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[1].getFirstName() + " "
                                   + customerList[1].getLastName() + "\nAccount: "
                                   + customerList[1].getAccountType() + "\nPin: "
                                   + customerList[1].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[2].getFirstName())
                              && pinVerifyStr.equals(customerList[2].getPin())) {
                         double balanceDouble = customerList[2].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[2].setValues(customerList[2].getFirstName(),
                                   customerList[2].getLastName(), customerList[2]
                                             .getPin(),
                                   customerList[2].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[2].getFirstName() + " "
                                   + customerList[2].getLastName() + "\nAccount: "
                                   + customerList[2].getAccountType() + "\nPin: "
                                   + customerList[2].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[3].getFirstName())
                              && pinVerifyStr.equals(customerList[3].getPin())) {
                         double balanceDouble = customerList[3].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[3].setValues(customerList[3].getFirstName(),
                                   customerList[3].getLastName(), customerList[3]
                                             .getPin(),
                                   customerList[3].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[3].getFirstName() + " "
                                   + customerList[3].getLastName() + "\nAccount: "
                                   + customerList[3].getAccountType() + "\nPin: "
                                   + customerList[3].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[4].getFirstName())
                              && pinVerifyStr.equals(customerList[4].getPin())) {
                         double balanceDouble = customerList[4].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[4].setValues(customerList[4].getFirstName(),
                                   customerList[4].getLastName(), customerList[4]
                                             .getPin(),
                                   customerList[4].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[4].getFirstName() + " "
                                   + customerList[4].getLastName() + "\nAccount: "
                                   + customerList[4].getAccountType() + "\nPin: "
                                   + customerList[4].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[5].getFirstName())
                              && pinVerifyStr.equals(customerList[5].getPin())) {
                         double balanceDouble = customerList[5].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[5].setValues(customerList[5].getFirstName(),
                                   customerList[5].getLastName(), customerList[5]
                                             .getPin(),
                                   customerList[5].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[5].getFirstName() + " "
                                   + customerList[5].getLastName() + "\nAccount: "
                                   + customerList[5].getAccountType() + "\nPin: "
                                   + customerList[5].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[6].getFirstName())
                              && pinVerifyStr.equals(customerList[6].getPin())) {
                         double balanceDouble = customerList[6].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[6].setValues(customerList[6].getFirstName(),
                                   customerList[6].getLastName(), customerList[6]
                                             .getPin(),
                                   customerList[6].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[6].getFirstName() + " "
                                   + customerList[6].getLastName() + "\nAccount: "
                                   + customerList[6].getAccountType() + "\nPin: "
                                   + customerList[6].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[7].getFirstName())
                              && pinVerifyStr.equals(customerList[7].getPin())) {
                         double balanceDouble = customerList[7].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[7].setValues(customerList[7].getFirstName(),
                                   customerList[7].getLastName(), customerList[7]
                                             .getPin(),
                                   customerList[7].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[7].getFirstName() + " "
                                   + customerList[7].getLastName() + "\nAccount: "
                                   + customerList[7].getAccountType() + "\nPin: "
                                   + customerList[7].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[8].getFirstName())
                              && pinVerifyStr.equals(customerList[8].getPin())) {
                         double balanceDouble = customerList[8].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[8].setValues(customerList[8].getFirstName(),
                                   customerList[8].getLastName(), customerList[8]
                                             .getPin(),
                                   customerList[8].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[8].getFirstName() + " "
                                   + customerList[8].getLastName() + "\nAccount: "
                                   + customerList[8].getAccountType() + "\nPin: "
                                   + customerList[8].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
                    if (nameVerifyStr.equals(customerList[9].getFirstName())
                              && pinVerifyStr.equals(customerList[9].getPin())) {
                         double balanceDouble = customerList[9].getBalance();
                         if (withdrawAmountDouble + chargeDouble > balanceDouble) {
                              JOptionPane.showMessageDialog(null,
                                        "Withdraw Exceeds Balance!");
                         } else {
                              balanceDouble -= (withdrawAmountDouble + chargeDouble);
                         customerList[9].setValues(customerList[9].getFirstName(),
                                   customerList[9].getLastName(), customerList[9]
                                             .getPin(),
                                   customerList[9].getAccountType(), balanceDouble);
                         textArea.append("\nCustomer: "
                                   + customerList[9].getFirstName() + " "
                                   + customerList[9].getLastName() + "\nAccount: "
                                   + customerList[9].getAccountType() + "\nPin: "
                                   + customerList[9].getPin() + "\nChanges: -"
                                   + withdrawAmountDouble + "\nBalance: "
                                   + formatDecimal.format(balanceDouble));
}Any suggestions would be much appreciated
- Thanks - GoOsE

(1) thanks for the wall of code.
(2) thanks for providing readers with the compilation errors.
(3) why are you using camelcase for Class names?
[*READ THIS*|http://mindprod.com/jgloss/abstract.html]
the errors seem very straight forward to me:
bankPresentation.java:34: cannot find symbol
symbol : class bankSummary
location: class bankPresentation
     bankSummary customerList[] = new bankSummary[10];
     ^
bankPresentation.java:34: cannot find symbol
symbol : class bankSummary
location: class bankPresentation
     bankSummary customerList[] = new bankSummary[10];
     ^
bankPresentation.java:38: bankPresentation is abstract; cannot be instantiated
          bankPresentation frame = new bankPresentation();
          ^
bankPresentation.java:103: abstract methods cannot have a body <---- PAY ATTENTION
     abstract void assignArray() {
     ^
4 errors
Tool completed with exit code 1

Similar Messages

  • How abstract class works?

    hello, every!
    i can't quite understand the abstract class.
    can a abstract class be inherited by a class in different package?
    thanks!

    you means define the class like this:
    public abtract class ClassA{
    a class can be define as public and abtract at the
    same time??Yes, certainly. Why don't you try it yourself?you are right.
    thanks.

  • Abstract class confusion

    I am writing a J2ME application, and I want to write a Record management system (RMS) that I can use in other J2ME programs. I have a Record class that RMS classes need to know about. The idea is that the Record class is abstract, and the implementation is defined by a subclass - depending on what the application needs to store. Any Record must provide the following:
    1) A constructor which takes a single byte[] parameter, which is the data read in from the RecordStore by the RMS. The implementation depends on what information is stored in this type of Record - it might be a String, series of ints, etc...
    2) A method getStorageFormat() which returns a btye[] representing the data to be stored in the RecordStore. Again, this is dependent on the application.
    I think that I have to use an abstract class here, so I have written an abstract class called Record - here's what it looks like:
    public abstract class Record {
         public Record(byte[] bytes) { }; //Should this be an empty constructor?
         public abstract byte[] getStorageFormat();
    }My problem is that I can't define a subclass of Record that works! Here's an example:
    public class MyRecord extends Record {
           String data1, data2, data3; //Some data that is stored in this record
           public MyRecord(byte[] bytes) {
                  String data = new String(bytes);
                  // do some processing to extract the data...
           public byte[] getStorageFormat() {
                  String sep = ","; //A seperator
                  String tmp = data1 + sep + data2 + sep + data3; //put all the data together with
                  return tmp.getBytes();
    }}I get an error in Eclipse with the MyRecord constructor that says:" The implicit super constructor Record() is undefined. Must explicity invoke another constructor". I tried super() but I get the same error. Can anyone please tell me what I am doing wrong? It seems to me that I am misunderstanding something about how abstract classes work.

    Because you defined a ctor that takes args, the implicit one that takes no args--super()--is no longer implicitly supplied. You have to either put a no-arg ctor into the parent class, or call the one that you already have.
    public Record(byte[] bytes) { }; //Should this be an empty constructor?
    public abstract byte[] getStorageFormat();
    }No. You don't want a ctor that takes args and does nothing. If you're taking that arg, then you should use it to initialize the state of the object.
    Here are the rules for constructors--"ctors" because I'm lazy. Also, because I'm lazy, "super(...)" and "this(...)" mean any super or this call, regardless of how many args it takes, including those that take no args.
    1) Every class has at least one ctor.
    1.1) If you do not define an explicit constructor for your class, the compiler provides a implicit constructor that takes no args and simply calls super().
    1.2) If you do define one or more explicit constructors, regardless of whether they take args, then the compiler no longer provides the implicit no-arg ctor. In this case, you must explicitly define a
    public MyClass() {...}
    if you want one.
    1.3) Constructors are not inherited.
    2) The first statement in the body of any ctor is either a call to a superclass ctor
    super(...)
    or a call to another ctor of this class
    this(...)
    2.1) If you do not explicitly put a call to super(...) or this(...) as the first statement in a ctor that you define, then the compiler implicitly inserts a call to super's no-arg ctor
    super()
    as the first call. The implicitly called ctor is always super's no-arg ctor, regardless of whether the currently running ctor takes args.
    2.2) There is always exactly one call to either super(...) or this(...) in each constructor, and it is always the first call. You can't put in more than one, and if you put one in, the compiler's implicitly provided one is removed.

  • Abstract class with set and get methods

    hi
    how to write set and get methods(plain methods) in an abstartc class
    ex: setUsername(String)
    String getUsername()
    and one class is extending this abstract class and same methods existing in that sub class also..... how to write......plz provide some ideas
    am new to programming....
    asap
    thnx in advance

    yes... as i told u.... i am new to coding......
    and my problem is ..... i have 2 classes one is abstract class without abstract methods.. and another class is extending abstract class.....
    in abstract class i have 2 methods...one is setusername(string) and getusername() ..... how to write these two methods.... in abstract class i have private variables username...... when user logins ..... i need to catch the user name and i need to validate with my oracle database and i need to identify the role of that user and based on role of that user i need to direct him to appropriate jsp page.......
    for that now i am writing business process classes..... the above mentioned two classes are from business process.....
    could u help me now
    thnx in advance

  • Why does this abstract class and method work without implement it?

    hi,
    I have seen many times that in some examples that there are objects made from abstract classes directly. However, in all books, manual and tutorials that I've read explain that we MUST implement those methods in a subclass.
    An example of what I'm saying is the example code here . In a few words that example makes Channels (java.nio.channel) and does operations with them. My problem is in the class to make this channels, because they used the ServerSockeChannel class and socket() method directly despite they are abstracts.
       // Create a new channel: if port == 0, FileChannel on /dev/tty, else
       // a SocketChannel from the first accept on the given port number
    private static ByteChannel newChannel (int netPort)
          throws Exception
          if (netPort == 0) {
             FileInputStream fis = new FileInputStream ("/dev/tty");
             return (fis.getChannel());
          } else {
    //CONFLICT LINES
             ServerSocketChannel ssc = ServerSocketChannel.open(); //<--I have never thought do that!! Anyway, how it is static method may work.
             ssc.socket().bind (new InetSocketAddress (netPort)); //<--but here, this method (socket) is abstract. WHY RETURN A SOCKET????????  this mehod should be empty by default.
             System.out.print ("Waiting for connection on port "
                + netPort + "...");
             System.out.flush();
             ByteChannel channel = ssc.accept();
             ssc.close();
             System.out.println ("Got it");
             return (channel);
       } I test this code and works fine. So why can it be??
    Also, I read that the abstract classes can't have static methods. Is it true???
    Please Help!!
    PS: i have seen this kind of code many times. So i feel that I don't understand how its really the abstract methods are made.
    PS2: I understand that obviously you don't do something like this: *"obj = new AbstractClass(); "*. I dont understand how it could be: ServerSocketChannel ssc = ServerSocketChannel.open(); and the compiler didn't warn.

    molavec wrote:
    ServerSocketChannel ssc = ServerSocketChannel.open(); //<--I have never thought do that!! Anyway, how it is static method may work.
    The static method creates an instance of a class which extends ServerSocketChannel, but is actually another non-abstract class.I thought that, but reading the documentation I saw that about open() method:
    Opens a server-socket channel.
    The new channel is created by invoking the openServerSocketChannel method of the system-wide default SelectorProvider object.
    The new channel's socket is initially unbound; it must be bound to a specific address via one of its socket's bind methods before connections can be accepted.
    ...and the problem is the same openServerSocketChannel is abstract, so i don't understand how it could return a ServerSocketChannel.There is a concrete implementation class that has implemented that method.
    I guess that really the open() method use a SelectorProvider's subclase but it doesn't appear in the doc.It doesn't need to. First, you don't care about those implementation details, and second, you know that if the class is abstract, it must use some concrete subclass.
    Ok, I speak Spanish by default (<-- this sounds like "I am a machine", ^_^' ). So, I didn't know how to say that the method would be {}. Is there a way to say that?? I recommendable for me to know, for the future questions o answers.Not sure what you're saying here. But the other respondent was trying to explain to you the difference between an abstract method and an empty method.
    // abstract method
    public abstract void foo();
    // empty method
    public void bar() {
    Which class does extend ServerSocketChannel? I can not see it.It may be a package-private class or a private nested class. There's no need to document that specific implementation, since you never need to use it directly.

  • JWSD RPC: abstract class or interface aren't working

    I have an abstract class called Record, and some classes that extend Record. These class have been added in the additionalTypes part of the configuration file (a copy of the config.xml is shown below)
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <service name="sscService"
    packageName="ssc"
    targetNamespace="http://www.eurice.de/infocitizen/ssc"
    typeNamespace="http://www.eurice.de/infocitizen/type/ssc">
    <interface name="ssc.server.SupplierPort"
    servantName="BasicSupplier"/>
    <typeMappingRegistry>
    <additionalTypes>
    <class name="ssc.ConnectionSpec"/>
    <class name="ssc.InteractionSpec"/>
    <class name="ssc.MappedRecord"/>
    <class name="ssc.IndexedRecord"/>
    <class name="ssc.server.ResultSet"/>
    <class name="ssc.server.SOAPNull"/>
    <class name="ssc.ResultSetMetaData"/>
    <class name="ssc.Entry"/>
    <class name="ssc.SupplierMetadata"/>
    <class name="ssc.EISMetadata"/>
    <class name="ssc.cl.BirthCertificate"/>
    </additionalTypes>
    </typeMappingRegistry>
    </service>
    </configuration>
    However the xrpcc tool issues the following error message:
    E:\Projects\ssc\.\xrpccServer\ssc\Record_SOAPSerializer.java:33: class ssc.Recor
    d is an abstract class. It can't be instantiated.
    Record instance = new Record();
    Can you help me?

    OK, I took your record class as is:
    public abstract class Record {
    private java.lang.String recordId;
    private java.lang.String name;
    private java.lang.String shortDescription;
    public java.lang.String getName() {
    return name;
    public void setName(java.lang.String name1){
    name=name1;
    public java.lang.String getShortDescription() {
    return shortDescription;
    public void setShortDescription(java.lang.String shortDescription1){
    shortDescription=shortDescription1;
    public java.lang.String getRecordId() {
    return recordId;
    public void setRecordId(java.lang.String id1){
    recordId=id1;
    Added a subclass:
    public class MyRecord extends Record {
    private int age;
    public MyRecord() {}
    public void setAge(int age) {
    this.age = age;
    public int getAge() {
    return age;
    Used the record in a service endpoint interface:
    public interface Interface extends Remote {
    public Record echo_Record(Record record) throws RemoteException;
    Put MyRecord as an additionalType in the config.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration
         xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <service name="Interface_Service"
    targetNamespace="http://echoservice.org/wsdl"
    typeNamespace="http://echoservice.org/types"
    packageName="stub_tie_generator_test">
    <interface name="stub_tie_generator_test.Interface"
    servantName="stub_tie_generator_test.InterfaceImpl"/>
    <typeMappingRegistry>
    <additionalTypes>
         <class name="stub_tie_generator_test.MyRecord"/>
    </additionalTypes>
    </typeMappingRegistry>
    </service>
    </configuration>
    And invoked the method with:
    Record rec = new MyRecord();
    ((MyRecord)rec).setAge(33);
    rec.setShortDescription("short");
    rec.setName("name");
    rec.setRecordId("id");
    Record returnedRec = stub.echo_Record(rec);
    assertTrue(((MyRecord)rec).getAge() == ((MyRecord)returnedRec).getAge());
    assertTrue(rec.getShortDescription().equals(returnedRec.getShortDescription()));
    assertTrue(rec.getRecordId().equals(returnedRec.getRecordId()));
    assertTrue(rec.getName().equals(returnedRec.getName()));
    and everything works. I am not sure what the problem you are having is.
    May I suggest you try my simplified example and see if it works for you.

  • Abstract classes and static methods

    I have an abstract report class AbstractReportClass which I am extending in multiple report classes (one for each report, say ReportA, ReportB, ...). Each report class has its own static column definitions, title, etc., which I have to access through a static method getDataMeta() in a web application. Each report has the same exact code in getDataMeta, and no report may exist without these fields. My intuition tells me that AbstractReportClass should contain the code for getDataMeta, but I know that you can't mix abstract and static keywords.
    Am I missing a simple solution to unify the getDataMeta code in the abstract base class? or do I really need to have a static function getDataMeta with the same code in each of the base classes?
    My apologies if this has been discussed many times before.
    Thanks,
    -Andrew

    I'm not trying to be "right"; rather I just asked a question about whether I can do something that seems intuitive. Perhaps you might write code in a different way than I would or perhaps I wasn't clear about every little detail about my code? Do you regularly belittle people who ask questions here?
    I have a loadFromDB() member function in AbstractReport for which all sub classes have an overloaded version. All reports I'm displaying have 4 common fields (a database id and a name and a monetary value, for example), but then each other report has additional fields it loads from the database. Inside ReportX classes' loadFromDB(), I call the superclass loadFromDB() function and augment values to get a completely loaded object. In fact, the loadedData member object resides in AbstractReport.
    I can't use a report unless it has these common features. Every report is an AbstractReport. There is common functionality built on top of common objects. Isn't this the point of inheritance? I'm essentially saying that abstract class Shape has a getArea function and then I'm defining multiple types of Shapes (e.g. Rectangle and Circle) to work with...

  • Abstract classes and methods with dollar.decimal not displaying correctly

    Hi, I'm working on a homework assignment and need a little help. I have two classes, 1 abstract class, 1 extends class and 1 program file. When I run the program file, it executes properly, but the stored values are not displaying correctly. I'm trying to get them to display in the dollar format, but it's leaving off the last 0. Can someone please offer some assistance. Here's what I did.
    File 1
    public abstract class Customer//Using the abstract class for the customer info
    private String name;//customer name
    private String acctNo;//customer account number
    private int branchNumber;//The bank branch number
    //The constructor accepts as arguments the name, acctNo, and branchNumber
    public Customer(String n, String acct, int b)
        name = n;
        acctNo = acct;
        branchNumber = b;
    //toString method
    public String toString()
    String str;
        str = "Name: " + name + "\nAccount Number: " + acctNo + "\nBranch Number: " + branchNumber;
        return str;
    //Using the abstract method for the getCurrentBalance class
    public abstract double getCurrentBalance();
    }file 2
    public class AccountTrans extends Customer //
        private final double
        MONTHLY_DEPOSITS = 100,
        COMPANY_MATCH = 10,
        MONTHLY_INTEREST = 1;
        private double monthlyDeposit,
        coMatch,
        monthlyInt;
        //The constructor accepts as arguments the name, acctNo, and branchNumber
        public AccountTrans(String n, String acct, int b)
            super(n, acct, b);
        //The setMonthlyDeposit accepts the value for the monthly deposit amount
        public void setMonthlyDeposit(double deposit)
            monthlyDeposit = deposit;
        //The setCompanyMatch accepts the value for the monthly company match amount
        public void setCompanyMatch(double match)
            coMatch = match;
        //The setMonthlyInterest accepts the value for the monthly interest amount
        public void setMonthlyInterest(double interest)
            monthlyInt = interest;
        //toString method
        public String toString()
            String str;
            str = super.toString() +
            "\nAccount Type: Hybrid Retirement" +
            "\nDeposits: $" + monthlyDeposit +
            "\nCompany Match: $" + coMatch +
            "\nInterest: $" + monthlyInt;
            return str;
        //Using the getter method for the customer.java fields
        public double getCurrentBalance()
            double currentBalance;
            currentBalance = (monthlyDeposit + coMatch + monthlyInt) * (2);
            return currentBalance;
    }File 3
        public static void main(String[] args)
    //Creates the AccountTrans object       
            AccountTrans acctTrans = new AccountTrans("Jane Smith", "A123ZW", 435);
            //Created to store the values for the MonthlyDeposit,
            //CompanyMatch, MonthlyInterest
            acctTrans.setMonthlyDeposit(100);
            acctTrans.setCompanyMatch(10);
            acctTrans.setMonthlyInterest(5);
            DecimalFormat dollar = new DecimalFormat("#,##0.00");
            //This will display the customer's data
            System.out.println(acctTrans);
            //This will display the current balance times 2 since the current
            //month is February.
            System.out.println("Your current balance is $"
                    + dollar.format(acctTrans.getCurrentBalance()));
        }

    Get a hair cut!
    h1. The Ubiquitous Newbie Tips
    * DON'T SHOUT!!!
    * Homework dumps will be flamed mercilessly. [Feelin' lucky, punk? Well, do ya'?|http://www.youtube.com/watch?v=1-0BVT4cqGY]
    * Have a quick scan through the [Forum FAQ's|http://wikis.sun.com/display/SunForums/Forums.sun.com+FAQ].
    h5. Ask a good question
    * Don't forget to actually ask a question. No, The subject line doesn't count.
    * Don't even talk to me until you've:
        (a) [googled it|http://www.google.com.au/] and
        (b) had a squizzy at the [Java Cheat Sheet|http://mindprod.com/jgloss/jcheat.html] and
        (c) looked it up in [Sun's Java Tutorials|http://java.sun.com/docs/books/tutorial/] and
        (d) read the relevant section of the [API Docs|http://java.sun.com/javase/6/docs/api/index-files/index-1.html] and maybe even
        (e) referred to the JLS for "advanced" questions.
    * [Good questions|http://www.catb.org/~esr/faqs/smart-questions.html#intro] get better Answers. It's a fact. Trust me on this one.
        - Lots of regulars on these forums simply don't read badly written questions. It's just too frustrating.
          - FFS spare us the SMS and L33t speak! Pull your pants up, and get a hair cut!
        - Often you discover your own mistake whilst forming a "Good question".
        - Often you discover that you where trying to answer "[the wrong question|http://blog.aisleten.com/2008/11/20/youre-asking-the-wrong-question/]".
        - Many of the regulars on these forums will bend over backwards to help with a "Good question",
          especially to a nuggetty problem, because they're interested in the answer.
    * Improve your chances of getting laid tonight by writing an SSCCE
        - For you normal people, That's a: Short Self-Contained Compilable (Correct) Example.
        - Short is sweet: No-one wants to wade through 5000 lines to find your syntax errors!
        - Often you discover your own mistake whilst writing an SSCCE.
        - Often you solve your own problem whilst preparing the SSCCE.
        - Solving your own problem yields a sense of accomplishment, which makes you smarter ;-)
    h5. Formatting Matters
    * Post your code between a pair of &#123;code} tags
        - That is: &#123;code} ... your code goes here ... &#123;code}
        - This makes your code easier to read by preserving whitespace and highlighting java syntax.
        - Copy&paste your source code directly from your editor. The forum editor basically sucks.
        - The forums tabwidth is 8, as per [the java coding conventions|http://java.sun.com/docs/codeconv/].
          - Indents will go jagged if your tabwidth!=8 and you've mixed tabs and spaces.
          - Indentation is essential to following program code.
          - Long lines (say > 132 chars) should be wrapped.
    * Post your error messages between a pair of &#123;code} tags:
        - That is: &#123;code} ... errors here ... &#123;code}
        - OR: &#91;pre]&#123;noformat} ... errors here ... &#123;noformat}&#91;/pre]
        - To make it easier for us to find, Mark the erroneous line(s) in your source-code. For example:
            System.out.println("Your momma!); // <<<< ERROR 1
        - Note that error messages are rendered basically useless if the code has been
          modified AT ALL since the error message was produced.
        - Here's [How to read a stacktrace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/].
    * The forum editor has a "Preview" pane. Use it.
        - If you're new around here you'll probably find the "Rich Text" view is easier to use.
        - WARNING: Swapping from "Plain Text" view to "Rich Text" scrambles the markup!
        - To see how a posted "special effect" is done, click reply then click the quote button.
    If you (the newbie) have covered these bases *you deserve, and can therefore expect, GOOD answers!*
    h1. The pledge!
    We the New To Java regulars do hereby pledge to refrain from flaming anybody, no matter how gumbyish the question, if the OP has demonstrably tried to cover these bases. The rest are fair game.

  • BUG:generate accessors not doing anything on abstract class

    I can't get a source file (abstract class) to generate accessors. I am using 10.1.3.0.0 production release. Concrete classes generate accessors fine.
    Here is how to reproduce the problem:
    Create an interface MyInterface with getMyThing() and setMyThing(String thing)
    Create an abstract class that implements MyInterface
    add a property and select generate accessor either from the source or from the menu "source"
    nothing happens
    remove the abstract keyword and the interface implementation -- generate accessors work fine
    Message was edited by:
    jgammon

    actually -- jdev version is 10.1.3.0.4 (SU1) build is JDEVADF_10.1.3_NT_060125.0900.3673

  • Problems implementing abstract classes

    hello.
    this is james mcfadden. I am developing a multiplayer BlackJack card game in Java. the game consists of three programs: BlackJack.java, BlackJackServer.java and BlackJackClient.java (three 3 programs are shown below). i don't know how to implement abstract classes. i am trying to get the BlackJack.java program working with the BlackJackServer.java program. there should be "extends BlackJackServer" somewhere in the BlackJack.java program, but i don't know where.
    import javax.swing.*;
    public class BlackJack extends JPanel{
       public BlackJack(){
          //FlowLayout is default layout manager for a JPanel
          add(new JButton("Hit"));
          add(new JButton("Stay"));
          add(new JButton("New Game"));
       public static void main(String[] args){
          JFrame frame=new JFrame("BlackJack");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(500,500);
          frame.setLocation(200,200);
          BlackJack bj=new BlackJack();
          frame.setContentPane(bj);
          frame.setVisible(true);
    import java.io.*;//Provides for system input and output through data streams, serialization and the file system
    import java.net.*;//Provides the classes for implementing networking applications
    import java.util.*;//Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes
    import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
    import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
    public class BlackJackServer extends JFrame{
       private JTextArea jta=new JTextArea();//a text area for displaying text
       public static void main(String[] args){  
              new BlackJackServer();//invokes the constructor BlackJackServer()
       }//end main
       public BlackJackServer(){
          setLayout(new BorderLayout());//places the text area on the frame
          add(new JScrollPane(jta),BorderLayout.CENTER);//lays out a text area, arranging and resizing its components to fit in the centre region;and provides a scrollable view of a lightweight component
          setTitle("BlackJack Server");//Sets the title for this frame to the specified string
          setSize(500,300);//Resizes this component so that it has a width and a height
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Sets the operation that will happen by default when the user closes this frame
          setVisible(true);//shows the frame
          try{
             ServerSocket serverSocket=new ServerSocket(8000);//creates a server socket
             jta.append("Server started at "+new Date()+'\n');//displays the current date in the text area
             Socket socket=serverSocket.accept();//listens for a connection request
             DataInputStream inputFromClient=new DataInputStream(socket.getInputStream());//creates a data input stream
             DataOutputStream outputToClient=new DataOutputStream(socket.getOutputStream());//creates a data output stream
             while(true){
                float bet=inputFromClient.readFloat();//receives bet from the client
                float doublebet=bet+bet;//computes double the bet
                outputToClient.writeFloat(doublebet);//sends double the bet back to the client
                jta.append("Bet received from client: "+bet+'\n');//displays the bet in the text area
                jta.append("Double the bet found: "+doublebet+'\n');//displays double the bet in the text area
             }//end while
          }//end try
          catch(IOException ex){
             System.err.println(ex);//displays an error message
          }//end catch
       }//end constructor
    }//end class BlackJackServer
    import java.io.*;//Provides for system input and output through data streams, serialization and the file system
    import java.net.*;//Provides the classes for implementing networking applications
    import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
    import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
    import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
    public class BlackJackClient extends JFrame{
       private JTextField jtf=new JTextField();//a text field for receiving text
       private JTextArea jta=new JTextArea();//a text area for displaying text
       private DataOutputStream toServer;//output stream
       private DataInputStream fromServer;//input stream
       public static void main(String[] args){
          new BlackJackClient();//invokes the constructor BlackJackClient()
       public BlackJackClient(){
          JPanel p=new JPanel();//holds the label and text field
          p.setLayout(new BorderLayout());//sets the layout of the content pane of this component by default
          p.add(new JLabel("Enter bet"),BorderLayout.WEST);//displays the bet and lays out a JLabel, arranging and resizing its components to fit in the western region
          p.add(jtf,BorderLayout.CENTER);//lays out the text field, arranging and resizing its components to fit in the centre region
          jtf.setHorizontalAlignment(JTextField.RIGHT);//Sets the horizontal alignment of the text to the right
          setLayout(new BorderLayout());//places the text area on the frame
          add(p,BorderLayout.NORTH);//lays out the text field, arranging and resizing its components to fit in the northern region
          add(new JScrollPane(jta),BorderLayout.CENTER);//lays out a text area, arranging and resizing its components to fit in the centre region;and provides a scrollable view of a lightweight component
          jtf.addActionListener(new ButtonListener());//invokes the ButtonListener class
          setTitle("BlackJack Client");//Sets the title for this frame to the specified string
          setSize(500,300);//Resizes this component so that it has a width and a height
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Sets the operation that will happen by default when the user closes this frame
          setVisible(true);//shows the frame
          try{
             Socket socket=new Socket("localhost",8000);//creates a socket to connect to the server
             fromServer=new DataInputStream(socket.getInputStream());//creates an input stream to receive data from the server
             toServer=new DataOutputStream(socket.getOutputStream());//creates an output stream to send data to the server
          }//end try
          catch(IOException ex){
             jta.append(ex.toString()+'\n');//displays an error message
          }//end catch
       private class ButtonListener implements ActionListener{
          public void actionPerformed(ActionEvent e){
             try{
                float bet=Float.parseFloat(jtf.getText().trim());//gets the bet from the text field
                toServer.writeFloat(bet);//Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream
                toServer.flush();//Flushes this output stream and forces any buffered output bytes to be written out
                float doublebet=fromServer.readFloat();//gets double the bet from the server
                jta.append("Bet is "+bet+"\n");//displays the bet in the text area
                jta.append("Double the bet received from the server is "+doublebet+'\n');//displays double the bet in the text area
             }//end try
             catch(IOException ex){
                System.err.println(ex);//displays an error message
             }//end catch
          }//end method
       }//end class
    }//end class BlackJackClient

    there should be "extends BlackJackServer" somewhere in the BlackJack.java programI very much doubt that.
    It's possible you might need to create a BlackJackServer object or something like that. But I don't see the point in subclassing it.

  • Question about Abstract Classes and Class Inheritance

    The semester is winding down, and the assignments are getting more complicated....
    Prof has given us a project involving both an interface and an abstract class. There's a class Person, then an abstract class Employee that extends Person, and two types of Employees (Hourly and Salaried) that extend Employee. The finished assignment is a type of payroll program that's supposed to be able to store both types of Employees and related info (name, salary, etc). One thing the prof suggested was to store both HourlyEmployees and SalariedEmployees in an array of Employees. But you can't instantiate an array of Employees directly, of course, since it's an abstract class.
    So is it possible to create an array of Persons, cast either HourlyEmployees or SalariedEmployees into Employee objects, and then store the Employee objects in the Person array? And if I do that, can I still use methods particular to the SalariedEmployees and/or HourlyEmployees once they are in the Person array? Or can I store SalariedEmployee and HourlyEmployee directly in an array of Persons, without having to cast them into anything else? (In that case, I'm not sure what the point of having the abstract Employee class is, though). Do they become just generic "Persons" if I do this?
    Thanks for any help!

    But you
    can't instantiate an array of Employees directly, of
    course, since it's an abstract class.Sure you can. You just can't instantiate Employee (the abstact class itself, as opposed to its subclasses) objects.
    Employee[] employees = new Employee[20];
    employees[0] = new HourlyEmployee();That should work.
    So is it possible to create an array of Persons, cast
    either HourlyEmployees or SalariedEmployees into
    Employee objects, and then store the Employee objects
    in the Person array?You could do that as well, but you shouldn't need to cast it.
    Given the type hierarchy you describe, an HourlyEmployee is a Person, so you should be able to assign an HourlyEmployee directly to a Person-valued variable.
    And if I do that, can I still use
    methods particular to the SalariedEmployees and/or
    HourlyEmployees once they are in the Person array?No. If the method doesn't exist in Person, then you can't call it on a Person variable, even if the method does exist in the class implementing Person.
    But if the method exists in Person, but is implemented and possibly overridden in HourlyEmployee, you can still invoke it, by just invoking the Person method.
    public interface Person {
      public void feed();
    public abstract class Employee implements Person {
      public abstract void hire();
    public class HourlyEmployee extends Employee {
    // then:
    Person persons = new Person[20];
    // add HourlyEmployees or SalariedEmployees to persons array...
    persons[0].feed(); // OK!
    persons[0].hire(); // NOT OK!

  • Abstract Class & Interfaces

    Can anyone please tell me as to why we need both an abstract class & an interface? I was asked in an interview as to why we need 2 separate concepts when we can get the similar functionality of an interface by using an abstract class. I had just sited their differences like:
    1) An abstract class can have both abstract & normal methods & that we can specify different access specifiers for its class members.
    2) ABAP does not support Multiple inheritance but that we could simulate the same using interfaces concept in ABAP.
    But he wasnt satisfied with the answer. I guess he was expecting something from a practical point of view. I did try searching the old threads but there wasnt anything similar to this. Anyone please explain by citing a scenario as to why we would need 2 separate concepts & not just one .
    Thanks in advance

    Hi
    Abstract classes
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    <b>Interfaces</b>
    Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.
    Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.
    The user never actually knows the providers of these services, but communicates with them through the interface.
    In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.

  • Abstract class, a question

    i have an abstract class called shape with default constructor (double y1, double y2);
    with an abstract method area.
    now i have a circle class which extends it, but i want its constructor to have ONE radius (as its pi radius*radius)
    at the moment this is how my circle looks like, and as you can see that there is really no need for second radius how can i modify circle class without modifying shape class?
    class circle extends Shape{
    circle(double radius, double radius1) {
         super(radius, radius);
    double area() {
    return (3.14*x1*x1);
    }

    the answer from the test class in above case will be
    0!Yes, because 3.14 * 0 * 0 is 0.
    but if i change the x3 above to x1, it would work, You honestly don't see why? It's staring you right in the face. What does area() use? How does that field get set?
    the
    reason i decided to use x3 is so that ppl dont get
    confuse! Here's what's confusing:
    * field names x1, x2, x3. What do those mean? They sound like 3 x coordinates.
    * two fields that are used by certain subclasses, but not others, and a third field that's used only by the subclasses that don't use the first two.
    * that third field meaning "the single value that applies to what both of the other two fields mean" instead of just setting both fields to the same value.
    * having any of those fields in there at all in the first place when they're not used by the abstract class and not used consistently by subclasses.
    but shouldnt it work because i have done the
    same thing i did to x1 and x2??

  • Abstract class, Interface and two models issue

    Hi!
    I will post my code and then ask the question (text between code snippets is bold, so you don't miss it, it's not shouting):
    public class AppScreen extends JFrame
                           implements ActionListener {
      private MemoryTableModel model;
      public AppScreen() {
        this.model = new MemoryTableModel();
           //code
      public void actionPerformed(ActionEvent actEvt) {
          if(table.getSelectedRow() != -1) {
            model.deleteRow(table.getSelectedRow());
          else {
            ErrDialog.noRowErr();
      public MemoryTableModel getModel() {
        return model;
    public class MemoryTableModel extends BasicTableModel
                                  implements MemoryTableInterface {
      public MemoryTableModel() {
        //code
      public synchronized void insertRow(String file, String time) {
        //code
      public synchronized void editRow(int selectedRow, String file, String time) {
        //code
    public synchronized void deleteRow(int selectedRow) {
        //code
    public abstract class BasicTableModel extends AbstractTableModel {
      private final String FILE_COLUMN = "Executable file";
      private final String TIME_COLUMN = "Time";
      protected String[] columnNames   = new String[2];
      protected List<RowRecord> data   = new ArrayList<RowRecord>();
      BasicTableModel() {
        //code
      public int getColumnCount() {
        //code
      public int getRowCount() {
        //code
      public String getValueAt(int row, int col) {
        //code
      public Class<? extends String> getColumnClass(int c) {
        //code
      public String getColumnName(int col) {
        //code
      public List<RowRecord> getData() {
        //code
      public int getTimeColumn() {
        //code
      public int getFileColumn() {
        //code
    public interface MemoryTableInterface {
      public void insertRow(String file, String time);
      public void editRow(int selectedRow, String file, String time);
      public void deleteRow(int selectedRow);
    In this form, everything works fine. But now, I would like to choose between two models at the start, so I thought I would do this:
    public class AppScreen extends JFrame
                           implements ActionListener {
      private BasicTableModel model;
      public AppScreen() {
        if(...) {
          this.model = new MemoryTableModel();
        else {
          this.model = new JDBCTableModel();
    public void actionPerformed(ActionEvent actEvt) {
          if(table.getSelectedRow() != -1) {
            model.deleteRow(table.getSelectedRow());
          else {
            ErrDialog.noRowErr();
      public BasicTableModel getModel() {
        return model;
    public class JDBCTableModel extends BasicTableModel
                                implements JDBCTableInterface {
      public JDBCTableModel(Connection conn)
        throws ClassNotFoundException, SQLException {
        //code
      public void insertRow(String file, String time) throws SQLException {
        //code
      public void editRow(int selectedRow, String newFile, String newTime)
          throws SQLException {
        //code
      public void deleteRow(int selectedRow) throws SQLException {
        //code
    public interface JDBCTableInterface {
      public void insertRow(String file, String time) throws SQLException;
      public void editRow(int selectedRow, String file, String time)
          throws SQLException;
      public void deleteRow(int selectedRow) throws SQLException;
    }But I'm getting error message from AppScreen that method deleteRow(int) is undefined for the type BasicTableModel. I thought if I initialize variable model as some implementation of BasicTableModel, it will be OK. Apparently it's not, so:
    where and what am I missing or
    how can I realize this choosing between two models so I don't have to write "if(model == MemoryModel) else if(model == JDBCModel)" around every method where I have to decide.
    Thanks!

    I would like to have issues interfacing with two classy models, as well. ;-)
    You need to have your BasicTobleModel class implement your JDBCTableInterface interface (even if it doesn't implement those methods itself), if that is how you intend to use that class.
    Edit: Too slow.

  • Abstract class causes JNI GetByteArrayElements to crash

    I'm having a problem with a subclass of an abstract class that is accessing a JNI function. I'm using Java 1.4.2.
    I started out with a single class that reads data from a serial port (via a JNI call) and then parses the data. When I test this class, the read/parse works correctly.
    Since I have to create multiple parsing protocols, I decided to create an abstract class that contained the reading functionality and a subclass that parses the data. When I did this, the 1st call to GetByteArrayElement never returns (nor do I get a stack dump trace).
    I also tried making the super-class non-abstract and over-writing the prase method(s). I got a similar failure.
    I can't imagine what the issue might be - why would splitting the original object into two (superclass/subclass) cause such a problem?
    I've include relevent snippits of code.
    Thanks for the help!
    ===== JNI Code =====
    extern JNIEXPORT jint JNICALL Java_vp_jni_Serial_read (JNIEnv *env,
         jclass class, jint fd, jbyteArray buf, jint cnt, jint offset)
         jboolean     iscopy = JNI_FALSE;
         // FAILS ON CALL; NEVER RETURNS!!!!
         const jbyte *data = GetByteArrayElements (env, buf, &iscopy);
         const uchar     *b;
         int               num,
                        rc;
         b = (uchar *) &data[offset];
         num = cnt;
         do
              rc = read (fd, (char *) b, num);
              if (handleReadException (env, rc) != 0)
                   (*env)->ReleaseByteArrayElements (env, buf, (jbyte *) data, 0);
                   return rc;
              num -= rc;
              b += rc;
         } while (num > 0);
         (*env)->ReleaseByteArrayElements (env, buf, (jbyte *) data, 0);
         return cnt;
    }==== Java Native Calls ====
    public class Serial
         public int read (byte[] data, int length, int offset)
              throws IOException
              return read (fd, data, length, offset);
         private static native int read (int fd, byte[] buf, int cnt, int offset)
              throws IOException;
    }==== Abstract super-class ====
    package vp.parse;
    import java.io.IOException;
    import java.io.InterruptedIOException;
    import java.io.SyncFailedException;
    import vp.jni.Serial;
    import vp.jni.Exec;
    import vp.data.ControlData;
    public abstract class Parse extends Thread
         protected static final int     ERROR = -1;
         private static final int     LOC_TIMEOUT = 3000;
         private Serial          link;
         private int               port;
         private boolean          running = false;
         private int               baud = Serial.B9600;
         protected abstract void reset ();
         protected abstract void parse ();
         public Parse (int port, String id, int baud)
              this.port = port;
              this.baud = baud;
              start ();
              synchronized (this)
                   try
                        wait (5000);
                   } catch (Exception e)
                        System.out.println (id + " Thread failed to synchronize");
              System.out.println ("Done");
         public void run ()
              link = new Serial(port);
              try
                   link.open();
                   link.setBaud (baud);
                   link.setTimeout (LOC_TIMEOUT);
              catch (Exception e )
                   link = null;
                   return;
              running = true;
              synchronized (this)
                   notify ();
              while (running)
                   parse ();
         protected int read (byte[] buf, int packetSize, int offset)
              if (offset >= packetSize)
                   offset = 0;
              if (offset > 0)
                   for (int i=0; i<packetSize - offset; i++)
                        buf[i] = buf[offset+i];
                   offset = packetSize - offset;
              try
                   int cnt = link.read (buf, packetSize - offset, offset);
                   offset = 0;          // all data is good
              // ready to 'close down' executable
              catch (Exception exp)
                   running = false;
                   return ERROR;
              return offset;
    }==== Sub-class to handle parsing ====
    package vp.parse;
    public class Eis extends Parse
         private static final int     PACKET_SIZE = 3 + 69 + 1;     // hdr, data, csum
         private byte[]          buffer = new byte[PACKET_SIZE];
         private int               offset = 0;
         public Eis (int port)
              super (port, "GR EIS", Serial.B9600);
         protected void reset ()
              offset = 0;
         protected void parse ()
              do
                   offset = read (buffer, PACKET_SIZE, offset);
                   if (offset == ERROR)
                        offset = 0;
                        return;
                   // parse code here
              } while (parse failed);
         public static void main (String[] argv)
              Eis e = new Eis (3);
              try { Thread.sleep (10000); } catch (Exception x) {}
    }

    The issue was the following:
    I had declared a buffer in the sub-class;
    private byte[] buffer = new byte[PACKET_SIZE];
    And the assumption would be that by the time it got used, it would be initialized. But that's not the case. Why?
    The sub-class called the super class constructor. At this point in time, buffer[] is not valid.
    The super class constructor spawns the child thread and waits for the spawned thread to finish initialization.
    The spawned thread creates the serial port, informs the constructor it's 'done' and starts to parse incoming data.
    The parse() code is the sub-class passes the uninitialized buffer to the JNI code and GetByteArrayElements crashes because id doesn't like a null pointer.
    Since the parent thread doesn't regain control to finish the construction, buffer[] never gets initialized.
    So much for synchronized thread spawning in a constructor...

Maybe you are looking for