ATM Transaction Program in Java


In this blog, we will learn to build a Java program that will carry out a simple ATM transaction where the user can perform operations like withdraw, deposit and balance check.

Operations That Can Be Performed

  1. Withdraw
  2. Deposit
  3. Checking Balance
  4. Exit

Algorithm for Each Operation

  1. Input the amount from the user that he/she wishes to withdraw.
  2. If the withdrawal amount is less than or equal to balance amount (i.e. withdrawalAmount ≤ balanceAmount), then perform the transaction (i.e. balanceAmount = balanceAmount — withdrawalAmount) and give the user’s desired amount.
  3. Else, print a message on the screen stating that the balance is insufficient.
  1. Input the amount from the user that he/she wishes to deposit.
  2. Add the deposit amount to the balance amount in the bank and update its value (i.e. balanceAmount = balanceAmount + depositAmount).
  3. Print a message on the screen stating that the transaction is successful.

When the user desires to check the balance amount in the bank, display the value of the balance amount on the screen.

When the user chooses the exit option, exit the current transaction mode and end the program.

Source Code

Here is the complete source code of a Java program that carries out the operations of a simple ATM transaction:

Source Code

Are you looking to master coding and crack top company interviews? Go ahead and try GUVI’s Pro Subscription to help you with everything needed to build a strong Technical Career.

Know more about GUVI:

Also, download GUVI’s app to learn the latest IT skills in vernacular languages.




Love podcasts or audiobooks? Learn on the go with our new app.

BIS 320 NERD Possible Is Everything /

Renraku release 1.0 — already integrated!

A Year in Review: A Guide to HashiCorp Basic Principles

Data Structures with Lists, Tuples, Dictionaries, and Sets in Python

Back to The Future of Agile Software Development

Web secret

Why Kubernetes?

Quality Assurance Testing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Baruni Priya T S

Baruni Priya T S

More from Medium

Java I/O Character Stream Implementation

Use of access modifiers in Java (public, protected, default and private)

What is Eclipse MicroProfile?

Create a Custom Annotation In JAVA