ATM Stimulation System (CLI)

ATM Simulation System (CLI)

Introduction:

Thanks for visiting the ATM Stimulation System! This Command-Line User Interface (CLI)-based ATM Stimulation System offers a clear and easy way to execute withdrawals, deposits, and check balances. Java is the programming language used to create it. The system includes a simple command line interface with a switch case for executing deposits, withdrawals, and balance checks. It also updates the current balance after each operation. Anyone who needs to quickly calculate deposits and withdrawals should use this system. So, sit back, make a cup of coffee, and start calculating the amount in the ATM Stimulation System.

Explanation:

This Command-Line User Interface (CLI)-based ATM Stimulation System offers a clear and easy way to execute withdrawals, deposits, and check balances. The system includes a simple command line interface with a switch case for executing deposits, withdrawals, and balance checks. It also updates the current balance after each operation.

Source Code:

 

				
					import java.util.Scanner;

public class ATM {
    public static void main(String args[]) {
        // declare and initialize balance, withdraw, and deposit
        int balance = 5000, withdraw, deposit;
        // create scanner class object to get choice of user
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("**Automated Teller Machine**");
            System.out.println("1. Withdraw");
            System.out.println("2. Deposit");
            System.out.println("3. Check Balance");
            System.out.println("4. EXIT");
            System.out.print("Choose the operation you want to perform:");

            // get choice from user
            int choice = sc.nextInt();
            switch (choice) {
                case 1:
                    System.out.print("Enter money to be withdrawn:");

                    // get the withdrawl money from user
                    withdraw = sc.nextInt();

                    // check whether the balance is greater than or equal to the withdrawal amount
                    if (balance >= withdraw) {
                        // remove the withdrawl amount from the total balance
                        balance = balance - withdraw;
                        System.out.println("Please collect your money");
                    } else {
                        // show custom error message
                        System.out.println("Insufficient Balance");
                    }
                    System.out.println("");
                    break;

                case 2:

                    System.out.print("Enter money to be deposited:");

                    // get deposite amount from te user
                    deposit = sc.nextInt();

                    // add the deposit amount to the total balanace
                    balance = balance + deposit;
                    System.out.println("Your Money has been successfully depsited");
                    System.out.println("");
                    break;

                case 3:
                    // displaying the total balance of the user
                    System.out.println("Balance : " + balance);
                    System.out.println("");
                    break;

                case 4:
                    // exit from the menu
                    System.exit(0);
                default:
                    //default statement
                    System.out.println("Invalid Choice");
            }
        }
    }
}
				
			

This system is built using Switch Case, while loop, and Scanner class. The system will first display the user’s available options. Withdraw, Deposit, Check Balance, and EXIT are available as choices. The user must choose a useful choice. The operation will be carried out as per the input choice, and the balance will be updated following each operation. The user could also get balance information in the “Check Balance” option.

Output:

 

ATM Stimulation System (CLI)

Find More Projects

Drawing Ganesha Using Python Turtle Graphics[Drawing Ganapati Using Python] Introduction In this blog post, we will learn how to draw Lord Ganesha …

Contact Management System in Python with a Graphical User Interface (GUI) Introduction: The Contact Management System is a Python-based application designed to …

KBC Game using Python with Source Code Introduction : Welcome to this blog post on building a “Kaun Banega Crorepati” (KBC) game …

Basic Logging System in C++ With Source Code Introduction : It is one of the most important practices in software development. Logging …

Snake Game Using C++ With Source Code Introduction : The Snake Game is one of the most well-known arcade games, having its …

C++ Hotel Management System With Source Code Introduction : It is very important to manage the hotels effectively to avail better customer …

More Java Projects
Get Huge Discounts

All Coding Handwritten Notes

Browse Handwritten Notes