Thursday 12 June 2014

Bank management

package trip;

import javax.swing.JOptionPane;
class banking
{
int id, bal, n, am, at, an, in, t,amount;
String name, actype;
public void in()
{
id=Integer.parseInt(JOptionPane.showInputDialog("enter customer ID"));
name=JOptionPane.showInputDialog("enter customer NAME");
actype=JOptionPane.showInputDialog("enter customer's ACCOUNT TYPE (current/saving)");
bal=Integer.parseInt(JOptionPane.showInputDialog("enter current BALANCE"));
}
public void calc()
{
if(actype.equals("current") && (bal>=5000))
{
n=Integer.parseInt(JOptionPane.showInputDialog("enter 1 for depositing amount, 2 for withdrawing amount"));
switch(n)
{
case 1:
am=Integer.parseInt(JOptionPane.showInputDialog("enter amount to depositt"));
bal=bal+am;
System.out.print("now amount is" +bal);
break;
case 2:
at=Integer.parseInt(JOptionPane.showInputDialog("enter amount to withdraw"));
bal=bal-at;
System.out.print("now amount is" +bal);
break;
default:
System.out.print("invalid");
}

}
else if(actype.equals("saving") && (bal>=5000))
{
an=Integer.parseInt(JOptionPane.showInputDialog("enter amount to depositt"));
bal=bal+an;
System.out.print("now balance is" +bal);
t=Integer.parseInt(JOptionPane.showInputDialog("enter amount in year"));
in=(bal*10*t)/100;
System.out.print("interest given to u is" +in);
amount=in+bal;
System.out.print("total amount is" +amount);
}
else
System.out.print("wrong key entered");

}
}


public class bank {

public static void main(String[] args) {
banking k=new banking();
k.in();k.calc();

}

}

output:
enter customer ID 01
enter customer NAME prity
enter customer's ACCOUNT TYPE (current/saving) current
enter current BALANCE 60000
enter 1 for depositing amount, 2 for withdrawing amount 1
enter amount to depositt 6000
now amount is66000

No comments:

Post a Comment

SAY HELLO!!