Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The second project involves writing a program that implements an ATM machine. The interface to the program should be a Java Swing GUI that looks

The second project involves writing a program that implements an ATM machine. The interface to the program should be a Java Swing GUI that looks similar to the following: The program should consist of three classes: P2GUI, Account and InsufficientFundsException. 1. Class P2GUI should define the GUI and should be hand-coded and not generated by a GUI generator. Class P2GUI must contain two Account objects, one for the checking account and another for the savings account. In addition to the main method and a constructor to build the GUI, event handlers will be needed to handle each of the four buttons shown above. When the Withdraw button is clicked, an attempt to withdraw the funds is made from the account selected by the radio buttons. The attempt might result in an exception being thrown for insufficient funds. In this situation, a JOptionPane window should be displayed explaining the error. When the Deposit button is clicked the specified amount should be deposited into the selected account. Clicking the Transfer button signifies transferring funds to the selected account from the other account. The transferred amount should be multiple of 10 dollars. The attempt might result in an exception being thrown for insufficient funds. In case of any error involving the transfer operation, a JOptionPane should be displayed explaining the error. Clicking the Balance button will cause a JOptionPane to be displayed showing the current balance in the selected account. Beside the specific checks indicated for each operation, the program should also check that all user inputted amounts are valid numeric values. Also, as a result of successful execution of the Withdraw, Deposit and Transfer operations, an acknowledge message will displayed in a JOptionPane window. 2. Class Account must have a constructor with one parameter representing the initial deposit plus four methods that correspond to each of the four buttons in the GUI. It must also incorporate logic to deduct a service charge of $1.75 when four total withdrawals are made from either account. Note that this means, for example, if one withdrawal is made from the checking and two withdrawals are made from the savings, any withdrawal from either account thereafter incurs the service charge. After the charge, the counter of withdrawals is reset. The methods that perform the withdrawals and transfers must throw an InsufficientFundsException whenever an 2 attempt is made to withdraw or transfer more funds than are available in the account. Note that when service charges apply, there must also be sufficient funds to pay for that charge. 3. InsufficientFundsException is a user defined checked exception class. Your program should compile without errors. The Google recommended Java style guide (https://google.github.io/styleguide/javaguide.html) should be used to format and document your code. Specifically, the following style guide attributes should be addressed: Header comments include filename, author, date and brief purpose of the program. In-line comments used to describe major functionality of the code. Meaningful variable names and prompts applied. Class names are written in UpperCamelCase. Variable names are written in lowerCamelCase. Constant names are in written in All Capitals. Braces use K&R style. In addition the following design constraints should be followed: Declare all instance variables private Avoid the duplication of code Test cases should be supplied in the form of a table with columns indicating what aspect is tested, the input values, expected output, actual output and if the test case passed or failed. This table should contain 5 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different scenarios to completely test the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions