-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATM.java
84 lines (74 loc) · 2.51 KB
/
ATM.java
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
77
78
79
80
81
82
83
84
import java.util.Scanner;
/**
*
* @author MUSTAFA KAYHAN ARICAN
*/
public class ATM {
public static void runn(Account ac)
{
Login entry = new Login();
Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to our Bank..");
System.out.println("***************************");
System.out.println("Client login");
System.out.println("***************************");
int acces = 3;
while (true)
{
if(entry.login(ac))
{
System.out.println("Access Succesful..");
break;
}
else
{
System.out.println("Accces unsuccesful!!!");
acces -=1;
System.out.println("Reaming acces right:"+acces);
}
if(acces ==0)
{
System.out.println("End of Rıght of Acces.....");
return ;
}
}
System.out.println("**********************");
String opers = "1. See Balance\n"+
"2. Deposit\n"+
"3. Wıthdraw\n"+
"4. Press 'q' for QUIT..";
System.out.println(opers);
System.out.println("**************************");
while (true)
{
System.out.println("Choose operation:");
String oper = scanner.nextLine();
if(oper.equals("q")){
break;
}
else if (oper.equals("1"))
{
System.out.println("Account Balance:"+ac.getBalance());
}
else if (oper.equals("2"))
{
System.out.println("Money which you want to deposite:");
int money =scanner.nextInt();
scanner.nextLine();
ac.deposit(money);
System.out.println("New balance:"+ac.getBalance());
}
else if (oper.equals("3"))
{
System.out.println("Money which you want to take:");
int tutar = scanner.nextInt();
scanner.nextLine();
ac.withdraw(tutar);
System.out.println("New balance:"+ac.getBalance());
}
else {
System.out.println("INVALID INPUT!");
}
}
}
}