-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATMProjesi.java
More file actions
71 lines (67 loc) · 2.83 KB
/
ATMProjesi.java
File metadata and controls
71 lines (67 loc) · 2.83 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package atm.projesi;
import java.util.Scanner;
public class ATMProjesi {
public static void main(String[] args) {
String userName, password;
Scanner input = new Scanner(System.in);
int right = 3;
int balance = 1500;
int select;
while (right > 0) {
System.out.print("Kullanıcı Adınız :");
userName = input.nextLine();
System.out.print("Parolanız : ");
password = input.nextLine();
if (userName.equals("patika") && password.equals("dev123")) {
System.out.println("Merhaba, Kodluyoruz Bankasına Hoşgeldiniz!");
do {
System.out.println("1-Para yatırma\n"
+ "2-Para Çekme\n"
+ "3-Bakiye Sorgula\n"
+ "4-Çıkış Yap");
System.out.print("Lütfen yapmak istediğiniz işlemi seçiniz : ");
select = input.nextInt();
switch (select) {
case 1:
{
System.out.print("Para miktarı : ");
int price = input.nextInt();
balance += price;
break;
}
case 2:
{
System.out.print("Para miktarı : ");
int price = input.nextInt();
if (price > balance) {
System.out.println("Bakiye yetersiz.");
} else {
balance -= price;
} break;
}
case 3:
System.out.println("Bakiyeniz : " + balance);
break;
default:
break;
}
} while (select != 4);
System.out.println("Tekrar görüşmek üzere.");
break;
} else {
right--;
System.out.println("Hatalı kullanıcı adı veya şifre. Tekrar deneyiniz.");
if (right == 0) {
System.out.println("Hesabınız bloke olmuştur lütfen banka ile iletişime geçiniz.");
} else {
System.out.println("Kalan Hakkınız : " + right);
}
}
}
}
}