-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathATM.java
More file actions
76 lines (63 loc) · 1.83 KB
/
ATM.java
File metadata and controls
76 lines (63 loc) · 1.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
72
73
74
75
76
package atm;
import java.io.*;
import java.util.*;
import BST.Binary_Search_Tree;
public class ATM extends Binary_Search_Tree{
// Taking Input from file to do the operations
private void Input_form_file() throws IOException
{
// Opening A file into scanner
Scanner scanner = new Scanner(new File("Input.txt"));
// Scanning and inserting in Tree
while(scanner.hasNextLine())
{
String Line = scanner.nextLine();
String Name = "";
int Acc,P;
Acc=P=0;
double ammount=0;
int i=0;
// scanning name
while(Line.charAt(i)!=' ')
{
Name+=Line.charAt(i++);
}
// scanning account no.
while(Line.charAt(++i)!=' ')
{
Acc=Acc*10+(Line.charAt(i)-'0');
}
// scanning password
while(Line.charAt(++i)!=' ')
{
P=P*10+(Line.charAt(i)-'0');
}
// scanning initial balance
++i;
while(i<Line.length())
{
ammount=ammount*10+(Line.charAt(i++)-'0');
}
// inseting the node in BST
insert(Name, Acc, P, ammount);
}
scanner.close();
}
// scanning ended here
// constructor to print the necessory info
public ATM()
{
System.out.println("\n******/ Welcome \\*******\n");
try{
Input_form_file();
// Print();
}catch(IOException e)
{
System.out.println("IO Exception in input form file");
}
}
// To check the account exists or not
public void Check(int A,boolean[] F){
search_Tree(A,F);
}
}