Banking system software code in Java

package com.physicsinfo;

import javax.swing.*;
import java.util.Scanner;

class account{
    int amount, acc_no; String name;
    void display(int acct_no, String name, int bal){
        System.out.println(acct_no+" "+name+" "+bal);
    void deposit(int amnt){
        amount = amount +amnt;
        System.out.println("Deposit successful. Your new balance is: "+amount);
    void withdraw(int wdr){
        if (wdr>amount){
            System.out.println("Insufficient balance.");
        else {
            amount = amount - wdr;
            System.out.println("Withdraw successful. Your new balance is: "+amount);



public class Main {
    public static void main(String args[]){
    int amt, wd, operation;
    account a=new account();
    String[] data = new String[3];
    Scanner sc = new Scanner(;
        System.out.print("Enter the account number: ");
        data[0] =;
        a.acc_no = Integer.parseInt(data[0]);
        System.out.print("Enter the account name: ");
        data[1] =; = data[1];
        System.out.print("Enter the initial balance: ");
        data[2] =;
        a.amount = Integer.parseInt(data[2]);
        System.out.println("1. Deposit");
        System.out.println("2. Withdraw");
        System.out.println("3. Check balance");
        System.out.println("4. Display info");
        System.out.println("5. Exit");
        System.out.print("Which operation do you want to perform: ");
        operation = sc.nextInt();
            case 1:
                System.out.print("Enter the amount you want to deposit: ");
                amt = sc.nextInt();
            case 2:
                System.out.print("Enter the amount you want to withdraw: ");
                wd = sc.nextInt();
            case 3:
                System.out.println("Your current balance is: "+a.amount);break;
            case 4: a.display(a.acc_no,, a.amount); break;


Leave a Comment

Your email address will not be published.