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

Im not sure where to even begin with writing this code in java. I need help in u

ID: 3687601 • Letter: I

Question

Im not sure where to even begin with writing this code in java. I need help in understanding the process of designing the layout.

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

The program should consist of three classes.

The first class is ATM. It should define the GUI and should be hand-coded and not generated by a GUI generator. 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, several checks must be made. The first check is to ensure the value in the text field is numeric. Next a check must be made to ensure the amount is in increments of $10. At that point 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, If any of those three errors occur a JOptionPane window should be displayed explaining the error. Otherwise a window should be displayed confirming that the withdrawal has succeeded. When the Deposit button is clicked the only necessary check is to ensure that the amount input in the textfield is numeric. Clicking the Transfer button signifies transferring funds to the selected account from the other account. The checks needed are to confirm that the amount supplied is numeric and that there are sufficient funds in the account from which the funds are being transferred. Clicking the Balance button will cause a JOptionPane window to be displayed showing the current balance in the selected account. The main Class ATM must also contain two Account objects, one for the checking account and another for the savings account.

The second class is Account. It must have a constructor plus a method that corresponds to each of the four buttons in the GUI. It must also incorporate logic to deduct a service charge of $1.50 when more than four total withdrawals are made from either account. Note that this means, for example, if two withdrawals are made from the checking and two from the savings, any withdrawal from either account thereafter incurs the service charge. The method that performs the withdrawals must throw an InsufficientFunds exception whenever an attempt is made to withdraw 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.

The third class is InsufficientFunds, which is a user defined checked exception.

Your program should compile without errors.

Be sure to follow good programming style, which means making all instance and class variables private, naming all constants, avoiding the duplication of code and using Java code conventions. Furthermore, you must select enough scenarios to completely test the program.

Explanation / Answer

advertisements

Output:

Sanfoundry Global Education & Learning Series – 1000 Java Programs.

Here’s the list of Best Reference Books in Java Programming, Data Structures and Algorithms.

1

  

advertisements

  

by Taboola

Sponsored Links

You May Like

The Ultimate Way to Get Cheap Hotel RoomsSave70

2016 Triumph Thruxton R First Ride Review auto.ndtv.com

Fun Quiz About Your HeartBigDecisions Quiz

You've been Overpaying for Flights... Until Now.Save70.com

The Ultimate Cheap Flights Finder is Here!Save70.com

Samsung and Yamaha Develop Smart Windshield Conceptauto.ndtv.com

Manish Bhojasia, a technology veteran with 19+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel. Stay connected with us below:
Google+ | Facebook | Twitter | LinkedIn

Subscribe Sanfoundry Newsletter and Posts

Subscribe

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment

Best Training

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

From The Web

That's How You Find Awesome Airfare Prices!Save70

Maruti Suzuki Vitara Brezza Launched in India; Prices, Specs, and Features Hereauto.ndtv.com