Coders Packet

ATM Interface display in Java

By SAI PRAVEEN ALLLAMPALLY

In this module, we are going to write a Java Program to Display the ATM Transaction. By using; if,if-else statements.

Options:

To represent ATM Interface, where a User has to choose input from the options displayed on the Screen. The available options on the Screen include operations such as mainly, Following are the basic operations available in the ATM 1.Check Balance 2.Deposit 3.Withdraw 4.Exit.

In this, mainly savings account is deposited amount of 15000.

import java.io.*;
public class atm {

  public static void displayBalance(int balance)
  {
    System.out.println("Current Balance : " + balance);
    System.out.println("Minimum balance should be maintained in your account");
    System.out.println();
  }

  public static int amountWithdrawing(int balance,int withdrawAmount)
  {
    System.out.println("Withdrawn Status:");
    System.out.println("Withdrawing Amount : " + withdrawAmount);
    if (balance >= withdrawAmount) 
    {
      balance = balance - withdrawAmount;
      System.out.println("Please collect your money and collect the card");
      displayBalance(balance);
    }
    else {
      System.out.println("Sorry! Insufficient Balance");
      System.out.println();
    }
    return balance;
  }

  public static int amountDepositing(int balance,int depositAmount)
  {
    System.out.println("Deposit Status:");
    System.out.println("Depositing Amount : " + depositAmount);
    balance = balance + depositAmount;
    System.out.println("Your Money has been successfully deposited in your account");
    System.out.println("Your deposited amount will be shown on the screen");
    displayBalance(balance);
    return balance;
  }

  public static void main(String args[])
  {
    int balance = 15000;
    int withdrawAmount = 2000;
    int depositAmount = 600;
    displayBalance(balance);
    balance= amountWithdrawing(balance, withdrawAmount);
        balance = amountDepositing(balance, depositAmount);
       System.out.println("Thank you.....");
       System.out.println("Have a nice day!");
  }
}

Output:

 

Download project

Reviews Report

Submitted by SAI PRAVEEN ALLLAMPALLY (9676539961SAIPRAVEEN)

Download packets of source code on Coders Packet