-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBankProject.java
More file actions
76 lines (72 loc) · 2.1 KB
/
BankProject.java
File metadata and controls
76 lines (72 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import java.util.*;
class BankProject {
public static String bankName = "MY BANK";
public String name,Address,city;
public double balance;
BankProject(String name)
{
this.name = name;
}
public void deposit(double amount)
{
this.balance = this.balance+amount;
System.out.println("After Deposit Balance is : "+this.balance);
}
public void withdraw(double amount)
{
if(amount>balance)
{
System.out.println("Insufficient Amount.......");
System.exit(0);
}
else
{
this.balance = this.balance-amount;
System.out.println("After Withdraw the Balnce is : "+this.balance);
}
}
public static void main(String[] args) {
System.out.println("*********************WELCOME TO MY BANK*************************************");
System.out.println("Welcome TO "+BankProject.bankName);
Scanner sc = new Scanner(System.in);
System.out.println("Enter Your Name : ");
String name = sc.next();
System.out.println("Enter your Address : ");
String addss = sc.next();
System.out.println("Enter City of customer : ");
String cty = sc.next();
BankProject c1 = new BankProject(name);
System.out.println("CONGRATULATIONS "+ c1.name+" Your Account Created");
System.out.println("\n\n");
while(true)
{
System.out.println("*********************WELCOME TO MY BANK*************************************");
System.out.println("Choose Your option to perform");
System.out.println("\n\t\t\tD-Deposit");
System.out.println("\n\t\t\tW-WithDraw");
System.out.println("\n\t\t\tE-Exit");
String option = sc.next();
if(option.equalsIgnoreCase("D"))
{
System.out.println("Enter Amount : ");
double amount = sc.nextDouble();
c1.deposit(amount);
}
else if(option.equalsIgnoreCase("W"))
{
System.out.println("Enter Amount To WithDraw : ");
double amount = sc.nextDouble();
c1.withdraw(amount);
}
else if(option.equalsIgnoreCase("E"))
{
System.out.println("Thanks For banking");
System.exit(0);
}
else
{
System.out.println("Invalid Option...");
}
}
}
}