Computer Project
Computer Project
I would also like to extend my gratitude to our Principal Mr. Tapas Kumar
Sinha and the school authority for providing me all the necessary items.
I would also like to thank my friends for all the thoughtful and mind
stimulating discussions we had, which prompted me to think beyond the
obvious.
1
Source Code
-->
import java.lang.*;
import java.util.*;
import java.time.*;
class Bank
2
static String intro_a[]; //Store name of introducer
*/
char ch=sc.next().charAt(0);
a=a+1;
int i=a-1;
switch(ch)
case 'a':
3
name_a=new String[1000];
addr_a=new String[1000];
lanmk_a=new String[1000];
phno_a=new long[1000];
name_a[i]=sc.nextLine();
addr_a[i]=sc.nextLine();
lanmk_a[i]=sc.nextLine();
phno_a[i]=sc.nextLong();
jch_a=new char[1000];
jch_a[i]=sc.next().charAt(0);
name2_a=new String[1000];
addr2_a=new String[1000];
lanmk2_a=new String[1000];
phno2_a=new long[1000];
op_a=new char[1000];
if(jch_a[i]=='y')
4
fal=sc.nextLine(); //#Prevent the
skipping of the line due to a bug which has been described in the
README.txt
name2_a[i]=sc.nextLine();
addr2_a[i]=sc.nextLine();
lanmk2_a[i]=sc.nextLine();
phno2_a[i]=sc.nextLong();
op_a[i]=sc.next().charAt(0);
intro_a=new String[1000];
acno_intro_a=new int[1000];
amt_a=new long[1000];
intro_a[i]=sc.nextLine();
acno_intro_a[i]=sc.nextInt();
amt_a[i]=sc.nextLong();
break;
5
case 'b':
phno_b=new long[1000];
name_b=new String[1000];
name_b[i]=sc.nextLine();
addr_b=new String[1000];
addr_b[i]=sc.nextLine();
lanmk_b=new String[1000];
lanmk_b[i]=sc.nextLine();
phno_b[i]=sc.nextLong();
jch_b=new char[1000];
jch_b[i]=sc.next().charAt(0);
name2_b=new String[1000];
addr2_b=new String[1000];
lanmk2_b=new String[1000];
phno2_b=new long[1000];
op_b=new char[1000];
if(jch_b[i]=='y')
6
fal=sc.nextLine(); //#Prevent the
skipping of the line due to a bug which has been described in the
README.txt
name2_b[i]=sc.nextLine();
addr2_b[i]=sc.nextLine();
lanmk2_b[i]=sc.nextLine();
phno2_b[i]=sc.nextLong();
op_b[i]=sc.next().charAt(0);
intro_b=new String[1000];
acno_intro_b=new int[1000];
amt_b=new long[1000];
intro_b[i]=sc.nextLine();
acno_intro_b[i]=sc.nextInt();
amt_b[i]=sc.nextLong();
break;
7
default:
System.out.println("Invalid choice!");
*/
char ch=sc.next().charAt(0);
int i;
switch(ch)
case 'a':
i=sc.nextInt();
System.out.println("Address: "+addr_a[i-1]);
System.out.println("Landmark: "+lanmk_a[i-1]);
if(jch_a[i-1]=='y')
8
System.out.println("Address: "+addr2_a[i-1]);
System.out.println("Landmark: "+lanmk2_a[i-1]);
switch(op_a[i-1])
case 'a':
System.out.println("Bank operation:
Joint");
break;
case 'b':
System.out.println("Bank operation:
Individual");
break;
else
break;
case 'b':
i=sc.nextInt();
9
System.out.println("Address: "+addr_b[i-1]);
System.out.println("Landmark: "+lanmk_b[i-1]);
if(jch_b[i-1]=='y')
System.out.println("Address: "+addr2_b[i-1]);
System.out.println("Landmark: "+lanmk2_b[i-1]);
switch(op_b[i-1])
case 'a':
System.out.println("Bank operation:
Joint");
break;
case 'b':
System.out.println("Bank operation:
Individual");
break;
else
10
System.out.println("Account Number of introducer:
"+acno_intro_b[i-1]);
break;
default:
System.out.println("Invalid choice!");
*/
char ch=sc.next().charAt(0);
int i;
switch(ch)
case 'a':
i=sc.nextInt();
long depo_a=sc.nextLong();
amt_a[i-1]=amt_a[i-1]+depo_a;
11
System.out.println("Account Balance: "+amt_a[i-1]);
break;
case 'b':
i=sc.nextInt();
long depo_b=sc.nextLong();
amt_b[i-1]=amt_b[i-1]+depo_b;
break;
default:
System.out.println("Invalid choice!");
*/
char ch=sc.next().charAt(0);
int i;
switch(ch)
12
case 'a':
i=sc.nextInt();
long with_a=sc.nextLong();
if(with_a<=amt_a[i-1])
amt_a[i-1]=amt_a[i-1]-with_a;
else
System.out.println("Withdraw Unsuccessful!");
break;
case 'b':
i=sc.nextInt();
long with_b=sc.nextLong();
if(with_b<=amt_b[i-1])
amt_b[i-1]=amt_b[i-1]-with_b;
13
System.out.println("Rs. "+with_b+" has been
withdrawn from account number"+i);
else
System.out.println("Withdraw Unsuccessful!");
break;
default:
System.out.println("Invalid choice!");
*/
int a=0;
a=a+1;
int i=a-1;
acno_fixdepo[i]=a;
14
long phno_fixdepo[]=new long[1000];
name_fixdepo[i]=sc.nextLine();
addr_fixdepo[i]=sc.nextLine();
phno_fixdepo[i]=sc.nextLong();
acno_depo[i]=sc.nextInt();
amt_fixdepo[i]=sc.nextLong();
duration[i]=sc.nextInt();
compound[i]=duration[i]*2;
mat_amt[i]=Math.rint(amt_fixdepo[i]*Math.pow((1+(0.05/2)),compound[i]
));
15
System.out.println("Account number of Fixed Deposit account:
"+acno_fixdepo[i]);
*/
char ch=sc.next().charAt(0);
int i;
switch(ch)
case 'a':
i=sc.nextInt();
name_a[i-1]=sc.nextLine();
addr_a[i-1]=sc.nextLine();
16
lanmk_a[i-1]=sc.nextLine();
phno_a[i-1]=sc.nextLong();
jch_a[i-1]=sc.next().charAt(0);
if(jch_a[i-1]=='y')
name2_a[i-1]=sc.nextLine();
addr2_a[i-1]=sc.nextLine();
lanmk2_a[i-1]=sc.nextLine();
phno2_a[i-1]=sc.nextLong();
op_a[i-1]=sc.next().charAt(0);
intro_a[i-1]=sc.nextLine();
17
System.out.print("Enter the Account Number of
introducer: ");
acno_intro_a[i-1]=sc.nextInt();
break;
case 'b':
i=sc.nextInt();
name_b[i-1]=sc.nextLine();
addr_b[i-1]=sc.nextLine();
lanmk_b[i-1]=sc.nextLine();
phno_b[i-1]=sc.nextLong();
jch_b[i-1]=sc.next().charAt(0);
if(jch_b[i]=='y')
name2_b[i-1]=sc.nextLine();
18
addr2_b[i-1]=sc.nextLine();
lanmk2_b[i-1]=sc.nextLine();
phno2_b[i-1]=sc.nextLong();
op_b[i-1]=sc.next().charAt(0);
intro_b[i-1]=sc.nextLine();
acno_intro_b[i-1]=sc.nextInt();
break;
default:
System.out.println("Invalid choice!");
*/
19
System.out.println("(a) Savings Account\t(b) Current
Account");
char ch=sc.next().charAt(0);
int i;
switch(ch)
case 'a':
i=sc.nextInt();
name_a[i-1]=null;
addr_a[i-1]=null;
lanmk_a[i-1]=null;
phno_a[i-1]=0;
name2_a[i-1]=null;
addr2_a[i-1]=null;
lanmk2_a[i-1]=null;
phno2_a[i-1]=0;
intro_a[i-1]=null;
acno_intro_a[i-1]=0;
amt_a[i-1]=0;
op_a[i-1]=' ';
jch_a[i-1]=' ';
break;
case 'b':
20
i=sc.nextInt();
name_b[i-1]=null;
addr_b[i-1]=null;
lanmk_b[i-1]=null;
phno_b[i-1]=0;
name2_b[i-1]=null;
addr2_b[i-1]=null;
lanmk2_b[i-1]=null;
phno2_b[i-1]=0;
intro_b[i-1]=null;
acno_intro_b[i-1]=0;
amt_b[i-1]=0;
op_b[i-1]='\u0000';
jch_b[i-1]='\u0000';
break;
default:
System.out.println("Invalid choice!");
*/
21
char ch=' ';
do
switch(ch1)
case 'a':
break;
case 'b':
break;
case 'c':
break;
case 'd':
break;
case 'e':
break;
case 'f':
break;
case 'g':
22
deleteData(); //Delete account information
break;
case 'h':
default:
System.out.println("Invalid choice!");
ch=ch1;
while(ch!='h');
23
Variable Description
24
amt_b Long Store the account balance.
jch_a Char Store the choice of account type.
jch_b Char Store the choice of account type.
op_a Char Store the choice of account operation.
op_b Char Store the choice of account operation.
depo_a Long Store the amount to be deposited in
account.
depo_b Long Store the amount to be deposited in
account.
with_a Long Store the amount to be withdrawn from
account.
with_b Long Store the amount to be withdrawn from
account.
acno_depo Int Store account number of main account.
acno_fixdepo Int Allot the account number to fixed deposit
account.
name_fixdepo String Store the name for fixed deposit account.
addr_fixdepo String Store the address for fixed deposit account.
phno_fixdepo Long Store the phone number for fixed deposit
account.
amt_fixdepo Long Store the amount to be deposited in fixed
deposit account.
duration Int Store the time period of fixed deposit
account.
mat_amt Double Calculate and store the maturity amount.
compound Int Store the number of the times interest is to
be compounded.
fal String Prevent the skipping of the line due to a
bug .
ch Char Check whether the user chooses ‘h’
ch1 Char Store the choice of user.
25
Output
26
Signature Page
27