Giter VIP home page Giter VIP logo

sma's Introduction

import java.util.; import javax.swing.; class Acount { int ano; String anm; int aopnbal; Vectortls; boolean astate; Acount() { ano=0; anm=new String(); aopnbal=0; astate=true; tls= new Vector();

 }
 int balEnd()
 {
    int bal = aopnbal,amt=0;
    int i=0,n=tls.size();
    while(i<n){
        Integer obj= tls.get(i);
        amt= obj.intValue();
        bal+=amt;
        i++;

    }
    return bal;
 }
 void set(int no)
 {
    ano=no;
    anm= JOptionPane.showInputDialog(null, "a/c holder name");
    try
    {
        aopnbal = Integer.parseInt(JOptionPane.showInputDialog(null, "opening balance"));
    }
    catch(Exception e)
    { 
        aopnbal=4000;

    }
    astate=true;
 }
 public String toString()
 {
    String a = "\n a/c no:" + ano + "\n name:" + anm + "\n opening balance" + tls + "closing balance: " + balEnd() + "\n state :" + astate;
    return a;
 }
 void display()
 {
    JOptionPane.showMessageDialog(null, toString());
 }
 void delrecord()
 {
    astate= false; 
 }
 void deposit()
 {
      int amt=0;
      try
      {
        amt= Integer.parseInt(JOptionPane.showInputDialog(null, "deposit amount"));

      }
      catch(Exception e)
      {
        amt=-1;

      }
      if(amt<=0)
      {
        JOptionPane.showMessageDialog(null,"invalid");
        return;
      }
      tls.add(amt);
 }
 void withdrow()
 {
    int amt=0;
      try
      {
        amt= Integer.parseInt(JOptionPane.showInputDialog(null, "withdrow amount"));

      }
      catch(Exception e)
      {
        amt=-1;

      }
      if(amt<=0)
      {
        JOptionPane.showMessageDialog(null,"invalid");
        return;
      }
      int bal = balEnd() - amt;
      if(bal<=500)
      {
        JOptionPane.showMessageDialog(null, "below 500");
        return;
      }
      tls.add(-amt);
 }
 void closeAcount()
 {
  int bal = balEnd();
  tls.add(-bal);
  delrecord();
 }

} class AcountList{ LinkedListls; Acount ref; AcountList() { ref=null; ls=new LinkedList(); } int search(int no) { int i=0,n=ls.size(); while(i<n){ ref=ls.get(i); if(ref.ano==no) break; i++;

}
if(i==n){
  ref=null;
  return -1;

}
else
  return i;

} void add() { int no=0; try { no=Integer.parseInt(JOptionPane.showInputDialog(null,"a/c no:")); } catch(Exception e) {

}
int pos=search(no);
if(pos>=0)
{
  JOptionPane.showMessageDialog(null,"record exit");
}
else
{
  ref=new Acount();
  ref.set(no);
  ls.add(ref);
}

} void mod() { int no=0; try { no=Integer.parseInt(JOptionPane.showInputDialog(null,"a/c no:")); } catch(Exception e) {

}
int pos=search(no);
if(pos==-1 || ref.astate==false)
{
  JOptionPane.showMessageDialog(null,"record  not exit");
}
else
 ref.set(no);

} void delet() { int no=0; try { no=Integer.parseInt(JOptionPane.showInputDialog(null,"a/c no:")); } catch(Exception e) {

}
int pos=search(no);
if(pos==-1 || ref.astate==false)
{
  JOptionPane.showMessageDialog(null,"record  not  exit");
  return;
}
else
 ref.closeAcount();

} void transact() { int no=0; try { no=Integer.parseInt(JOptionPane.showInputDialog(null, "a/c no:")); } catch(Exception e) {

}
int pos=search(no);
if(pos==-1 || ref.astate==false)
{
  JOptionPane.showMessageDialog(null,"record  not  exit");
  return;
}
int opt= JOptionPane.showOptionDialog(null, "choose option", "transaction" ,JOptionPane.YES_OPTION,JOptionPane.INFORMATION_MESSAGE,null,new String[]{"depo","withd","balance","back"} ,0);
switch(opt)
{
  case 0:
    ref.deposit();
    break;
  case 1:
     ref.withdrow();
     break;
  case 2:
    JOptionPane.showMessageDialog(null,"Balance:" + ref.balEnd());
}

}

}

sma's People

Contributors

sanika301 avatar tejaswini16256 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.