Question
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,
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started