Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create Java program using GUI Javafx that simulates a bank ATM. Must compile and

ID: 3849387 • Letter: C

Question

Create Java program using GUI Javafx that simulates a bank ATM. Must compile and run using eclipse.

***You MUST put the required comment information at the beginning of every class you write and use appropriate comments throughout the code to explain general functionality.

-Bank ATM should open in a single window that is exactly ¾ of the screen width and height.

--It should contain a menu bar at the top of the window that allows access to various ATM system functions.

--The program should only ever exit using the menu bar.

-The ATM must ask for an ‘ATM Card’ (a number as input) and an ‘ATM Pin’ (a number as input) that corresponds to that ‘ATM Card’

--The ATM must assure proper access (login) before proceeding to the corresponding account information.

--If a customer is not already in the ATM system they should be able to create an account with a new ‘ATM Card’ and ‘ATM Pin’

-The program must display at least 3 basic functions (withdrawal, deposit, get balance) once a customer is logged-in.

--A function can be selected by either clicking on the function specific button or accessing the function from the menu items.

--When a function is selected, the program should look-up the account information from an account history file and update the file based on the function performed.

-Overall, there is no limit to the number of transactions that can take place during one session of use.

-There are two withdrawal limits for any account

--No more than $1000.00

--No more than 70% of the account balance

-At any time the customer can exit the system and be assured of a successful log-out of the system.

-JavaFX Interface Requirements

--A single JavaFX Stage window with menu bar functionality

--The main stage should only close by choosing ‘file->close’

--The Menu bar should include at least:

---File, Options ,Help

---Buttons that allow functionality for:

----Login/Logout

----Withdrawal (‘Quick’, or specified amount) Deposit

----Get Balance

----Create New Account

----Change Pin

----Transfer Funds

------Requires two ‘ATM Cards’ and ‘ATM Pin

------Print Receipt (Print to File not a printer)

-------The contents of the receipt must include but not limited to:

---------The date

---------The ATM card(s) # that preform the action

---------Only the last 3 digits are visible (XXXXXXXX123)

---------The action (withdrawdeposit ransfer)

---------The current balance

-------View Transaction History

--All of the above functions should be available from user interface buttons as well (not all on the screen at once)

--A status bar to show the current transactional history for the current session

--A label box above the status bar to show the current account number and current balance that updates as transactions occur

--The main GUI should not be re-sizeable

--All items should contain a ‘text-tooltip’ that describes the item.

-Operational Requirements

--There must be an entire Bank history file to track all accounts and number of transactions (Bank.txt)

--The entire bank file should be formatted in the following way:

---ATM Card#<<, >>ATM Pin<<,>>number of all transactions

--There must be an account history file for each created account (acct###.txt)

--The individual account files should be formatted in the following way:

---ATM Card#<>ATM Pin#<> Balance<>Transaction

--All account data should be ‘looked-up’ from the corresponding account file

---This should be an output file named ‘receipt-MM-DD-YY.txt’

---It should be saved to the folder where the program is running.

--No ‘JAVA threads’ are necessary

--Bank ATM must contain at least one exception handler.

-Make appropriate use of classes and methods to simplify the design and support the abstraction of the various data objects and operations. Do not create many classes in one file. Try to have a separate file for each class.

-You MUST put the required comment information at the beginning of every class you write and use appropriate comments throughout the code to explain general functionality.

Explanation / Answer

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.io.*;

public class ATM {

    static JFrame ATMFrame = new JFrame("ATM");

  // ATM constructor

    public ATM() throws IOException {

        // Instantiate a new ATMDataFile object called atmData

        ATMDataFile atmData = new ATMDataFile();

        loginGUI();

        ATMFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        ATMFrame.setSize(400,200);

}

  public static void loginGUI() {         

    //Create and set up the ATM Login content pane.

    final ATMLogin loginContentPane = new ATMLogin(ATMFrame);

    ATMFrame.setContentPane(loginContentPane);

    //Make sure the focus goes to the right component

    //whenever the ATMFrame is initially given the focus.

    ATMFrame.addWindowListener(new WindowAdapter() {

      public void windowActivated(WindowEvent e) {

        loginContentPane.resetFocus();

      }

    });      

    //Display the pane.

     ATMFrame.setVisible(true);

  }

  public static void chooserGUI() {

    //Create and set up the ATM Login content pane.

    final ATMChooser chooserPane = new ATMChooser(ATMFrame);

    ATMFrame.setContentPane(chooserPane);

    //Display the window.

    ATMFrame.setVisible(true);

  }

  public static void withdrawGUI() {         

    //Create and set up the ATM Login content pane.

    final ATMWithdraw withdrawContentPane = new ATMWithdraw(ATMFrame);

    withdrawContentPane.setLayout(new GridLayout(0,1));

    ATMFrame.setContentPane(withdrawContentPane);     

    //Display the window.

     ATMFrame.setVisible(true);

  }

   

  public static void depositGUI() {         

    //Create and set up the ATM Login content pane.

    final ATMDeposit depositContentPane = new ATMDeposit(ATMFrame);

    depositContentPane.setLayout(new GridLayout(0,1));

    ATMFrame.setContentPane(depositContentPane);     

    //Display the window.

     ATMFrame.setVisible(true);

  }

   

  public static void transferGUI() {         

    //Create and set up the ATM Login content pane.

    final ATMTransfer transferContentPane = new ATMTransfer(ATMFrame);

    transferContentPane.setLayout(new GridLayout(0,1));

    ATMFrame.setContentPane(transferContentPane);     

    //Display the window.

     ATMFrame.setVisible(true);

     }

  public static void balanceGUI() {

    //Create and set up the ATM Login content pane.

    final ATMBalance balanceContentPane = new ATMBalance(ATMFrame);

    balanceContentPane.setLayout(new GridLayout(3,1));

    ATMFrame.setContentPane(balanceContentPane);

    //Display the window.

     ATMFrame.setVisible(true);

  }

  public static void main(String[] args) throws IOException {

    ATM atm = new ATM();

  }  

}