package com.tcs.ilp; public class BankDetails { String emp_id; String emp_role; double emp_salary; //String cust_name; //double loan_amount; //int branch_code; BankDetails(String id,String role,double salary) { emp_id=id; emp_role=role; emp_salary=salary; } void setSalary(double sala) { emp_salary=sala; } } package com.tcs.ilp; import java.util.*; public class BankFunctions { Scanner sc=new Scanner(System.in); void performFunctions() { ArrayList<BankDetails> arl=new ArrayList<BankDetails>(); ArrayList<BankDetails> arl1=new ArrayList<BankDetails>(); BankDetails bank1=new BankDetails("1001","agm",50000); BankDetails bank2=new BankDetails("1002","agm",40000); BankDetails bank3=new BankDetails("1003","dgm",30000); BankDetails bank4=new BankDetails("1004","gm",20000); BankDetails bank5=new BankDetails("1005","clerk",10000); BankDetails bank6=new BankDetails("1006","clerk",10000); arl.add(bank1); arl.add(bank2); arl.add(bank3); arl.add(bank4); arl.add(bank5); arl.add(bank6); int i1=1; while(i1!=-1) { System.out.println("YOUR COHOICES"); System.out.println("1: VIEW EMPLOYEES SALARIES"); System.out.println("2: GET LOAN"); System.out.println("ENTER CHOICES"); int ch=sc.nextInt(); switch(ch) { case 1: System.out.println("OLD RECORDS ARE :"); for(int k=0;k<arl.size();k++) { System.out.println(arl.get(k).emp_id); System.out.println(arl.get(k).emp_role); System.out.println(arl.get(k).emp_salary); } for(int i=0;i<arl.size();i++) { if(arl.get(i).emp_role.equals("agm")) { double sal=arl.get(i).emp_salary; sal=sal+.20*sal; arl.get(i).setSalary(sal); } else if(arl.get(i).emp_role.equals("dgm")) { double sal=arl.get(i).emp_salary; sal=sal+.15*sal; arl.get(i).setSalary(sal); } else if(arl.get(i).emp_role.equals("gm")) { double sal=arl.get(i).emp_salary; sal=sal+.10*sal; arl.get(i).setSalary(sal); } else if(arl.get(i).emp_role.equals("clerk")) { double sal=arl.get(i).emp_salary; sal=sal+.25*sal; arl.get(i).setSalary(sal); } } System.out.println("UPDATED RECORDS ARE :"); for(int j=0;j<arl.size();j++) { System.out.println(arl.get(j).emp_id); System.out.println(arl.get(j).emp_role); System.out.println(arl.get(j).emp_salary); } break; case 2: System.out.println("Enter the name"); String cname=sc.next(); System.out.println("Enter the loan amount"); double camount=sc.nextDouble(); System.out.println("enter the branch(1:jnk 2: bangalore 3: others"); int bcode=sc.nextInt(); if (bcode==1) { if(camount>=100000 && camount<=500000) { System.out.println("Earlier Interest rates ="+11); System.out.println("New rates are="+11.5); System.out.println("Therefore yearly interest of" +.11*camount+ " goes to" +.115*camount); } else if(camount>=500000 && camount<=700000) { System.out.println("Earlier Interest Rate="+13); System.out.println("New interest rates="+13.2); System.out.println("net payment earlier of "+ .13*camount +"goes to "+ .132*camount); } else { System.out.println("Earlier Interest Rate="+15); System.out.println("New interest rates="+16); System.out.println("net payment earlier of "+ .15*camount +"goes to "+ .16*camount); } } else if(bcode==2) { if(camount>=100000 && camount<=500000) { System.out.println("Earlier Interest rates ="+11); System.out.println("New rates are="+13); System.out.println("Therefore yearly interest of" +.11*camount+ " goes to" +.13*camount); } else if(camount>=500000 && camount<=700000) { System.out.println("Earlier Interest Rate="+13); System.out.println("New interest rates="+15); System.out.println("net payment earlier of "+ .13*camount +"goes to "+ .15*camount); } else { System.out.println("Earlier Interest Rate="+15); System.out.println("New interest rates="+18); System.out.println("net payment earlier of "+ .15*camount +"goes to "+ .18*camount); } } else if(bcode==3) { if(camount>=100000 && camount<=500000) { System.out.println("Earlier Interest rates ="+11); System.out.println("New rates are="+12); System.out.println("Therefore yearly interest of" +.11*camount+ " goes to" +.12*camount); } else if(camount>=500000 && camount<=700000) { System.out.println("Earlier Interest Rate="+13); System.out.println("New interest rates="+13.5); System.out.println("Therefore earlier interest of "+ .13*camount +"goes to "+ .135*camount); } else { System.out.println("Earlier Interest Rate="+15); System.out.println("New interest rates="+16.5); System.out.println("Therefore earlier interest of "+ .15*camount +"goes to "+ .165*camount); } } } System.out.println("enter 1 to continue 0 to exit"); int ter=sc.nextInt(); if (ter==1) { i1++; } else {i1=-1;} } } } package com.tcs.ilp; public class BankMain { public static void main(String args[]) { BankFunctions bafu=new BankFunctions(); bafu.performFunctions(); } }
Ads