0% found this document useful (0 votes)
21 views4 pages

Us006, Us007, Us008, Us009, Us010 Java

The document contains Java code to create a basic banking application that allows users to create an account, deposit money, withdraw money, and check their balance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views4 pages

Us006, Us007, Us008, Us009, Us010 Java

The document contains Java code to create a basic banking application that allows users to create an account, deposit money, withdraw money, and check their balance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

US006,US007,US008,US009 JAVA

Code:-
import java.util.*;

public class Main {


static double bal = 500;
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Choose from the options given below:");
System.out.println("1. Create Account");
System.out.println("2. Deposit Amount");
System.out.println("3. Withdraw Amount");
System.out.println("4. Balance Checking");
int option = sc.nextInt(); sc.nextLine();

switch (option) {
case 1:
createAcc();
break;
case 2:
depositAmount(bal);
break;
case 3:
withdrawAmount();
break;
case 4:
balanceCheck();
break;
default:
System.out.println("Invalid option");
}
}
public static void createAcc()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter SSN ID:");
System.out.println("Enter name:");
System.out.println("Enter email:");
System.out.println("Enter address:");
System.out.println("Enter Contact Number:");
System.out.println("Enter Aadhar Number:");
System.out.println("Enter Pan Number:");
double ssn = sc.nextDouble();sc.nextLine();
String name = sc.nextLine();
String email = sc.nextLine();
String add = sc.nextLine();
String num = sc.nextLine();
String aadharNum = sc.nextLine();
String panNum = sc.next();
System.out.println("Hurray! We've successfully created account");
}
public static void depositAmount(double bal)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter amount to deposit");
double amount = sc.nextDouble(); sc.nextLine();
bal += amount;
System.out.println("Amount successfully deposited: "+bal);

public static void withdrawAmount()


{
Scanner sc = new Scanner(System.in);
System.out.println("Enter amount to withdraw");
double amount = sc.nextDouble();
if(amount>bal)
{
System.out.println("Insufficient funds");
}
else
{
bal -= amount;
System.out.println("Amount successfully withdrawn"+bal);
}

public static void balanceCheck()


{
System.out.println("Your balance is"+bal);
}
}

Create Account:-
Deposit Amount:-
Withdraw Amount:-

Balance Checking:-

You might also like