@@ -17,7 +17,7 @@ public static void main(String Args[]) throws IOException, ClassNotFoundExceptio
1717 try {
1818 f .init ();
1919 }
20- catch (java . io . EOFException e ){
20+ catch (EOFException | StreamCorruptedException e ){
2121 f .Database .Data [1 ]=new account ();
2222 f .uploadChanges ();
2323 f .init ();
@@ -51,16 +51,16 @@ public static void main(String Args[]) throws IOException, ClassNotFoundExceptio
5151 }
5252 }
5353 }
54- System .out .println ("Welcome, " +ac .Name );
55- System .out .println ("____________________________________ " );
54+ System .out .println ("Welcome, " +ac .Name + "________________________" );
55+ // System.out.println("____________________________________________ ");
5656 System .out .println ("What do you want to do ?" );
57- System .out .println ("1:Withdraw\t \t 2:Deposit\n 3:Display Details" );
57+ System .out .println ("1:Withdraw\t \t 2:Deposit\n " +
58+ "3:Display Details___________________________" );
5859 System .out .print ("Enter your selection :" );
5960 int choice =in .nextInt ();
6061 switch (choice ){
6162 case 1 :
62- System .out .println ("Deposit:" );
63- System .out .println ("____________________________________" );
63+ System .out .println ("Withdraw:___________________________________" );
6464 Scanner c1 =new Scanner (System .in );
6565 System .out .print ("Enter the Amount you want to withdraw :" );
6666 String withdraw =c1 .nextLine ();
@@ -70,31 +70,43 @@ public static void main(String Args[]) throws IOException, ClassNotFoundExceptio
7070 }
7171 else {
7272 ac .balance =String .valueOf (Integer .valueOf (ac .balance )-Integer .valueOf (withdraw ));
73+ if (withdraw .length ()>=4 ){
74+ ac .transactionHistory =ac .transactionHistory +"Withdraw\t " +withdraw +"\t \t -----\t \t " +ac .balance +"\n " ;
75+ }
76+ else
77+ ac .transactionHistory =ac .transactionHistory +"Withdraw\t " +withdraw +"\t \t \t -----\t \t " +ac .balance +"\n " ;
7378 f .Database .Data [failsafe ]=ac ;
7479 f .uploadChanges ();
7580 f .init ();
81+ System .out .println ("Remaining Balance\t :" +ac .balance );
7682 }
7783 break ;
7884
7985 case 2 :
8086 Scanner c2 =new Scanner (System .in );
81- System .out .println ("Withdraw:" );
82- System .out .println ("____________________________________" );
87+ System .out .println ("Deposit:____________________________________" );
8388 System .out .print ("Enter the Amount you want to Deposit :" );
8489 String deposit =c2 .nextLine ();
8590 ac .balance =String .valueOf (Integer .valueOf (ac .balance )+Integer .valueOf (deposit ));
91+ if (deposit .length ()>=4 ) {
92+ ac .transactionHistory = ac .transactionHistory + "Deposit\t \t -----\t \t " + deposit + "\t \t " + ac .balance + "\n " ;
93+ }
94+ else
95+ ac .transactionHistory = ac .transactionHistory + "Deposit\t \t -----\t \t " + deposit + "\t \t \t " + ac .balance + "\n " ;
8696 f .Database .Data [failsafe ]=ac ;
8797 f .uploadChanges ();
8898 f .init ();
8999 System .out .println ("Transaction Successful" );
100+ System .out .println ("Remaining Balance\t :" +ac .balance );
90101 break ;
91102
92103 case 3 :
93- System .out .println ("Account Details" );
94- System .out .println ("____________________________________" );
104+ System .out .println ("Account Details_____________________________" );
95105 System .out .println ("Name\t :" +ac .Name );
96106 System .out .println ("ID\t \t :" +ac .ID );
97107 System .out .println ("Balance\t :" +ac .balance );
108+ System .out .println ("Transaction History_________________________\n " +ac .transactionHistory );
109+ System .out .println ("____________________________________________" );
98110 }
99111 FileWriter fw = new FileWriter ("idthreshold.txt" ,true );
100112 BufferedWriter bw =new BufferedWriter (fw );
0 commit comments