title: How to use Big Decimal in Jav ATW
body: <pre><code>package SI;
  
  import java.awt.*;
  import java.awt.event.*;
  import java.lang.*;
  import java.math.*;
  import java.math.BigDecimal;
  import static oracle.jrockit.jfr.events.Bits.doubleValue;
  import static oracle.jrockit.jfr.events.Bits.floatValue;
  import static oracle.jrockit.jfr.events.Bits.intValue;
  
  public class SI extends Frame implements ActionListener{
      TextField ptf,rtf,ttf,sitf,atf,citf,atf1;
      Button ab,sib,cib,ab1;
      Label pl,rl,tl,sil,al,cil,al1;
      SI(){
          pl=new Label("Principal:");
          pl.setBounds(15,50,50,20);
          ptf=new TextField();
          ptf.setBounds(150, 50, 150, 20);
  
          rl=new Label("Rate:");
          rl.setBounds(15,100,50,20);
          rtf=new TextField();
          rtf.setBounds(150, 100, 150, 20);
  
          tl=new Label("Time:");
          tl.setBounds(15,150,50,20);
          ttf=new TextField();
          ttf.setBounds(150, 150, 150, 20);
  
          sil=new Label("Simple Interest:");
          sil.setBounds(15,200,150,20);
          sitf=new TextField();
          sitf.setBounds(150, 200, 150, 20);
          sitf.setEditable(false);
  
          sib=new Button("Simple Interest");
          sib.setBounds(120,400,100,50);
          sib.addActionListener(this);
  
          cil=new Label("Compound Interest:");
          cil.setBounds(15,250,200,20);
          citf=new TextField();
          citf.setBounds(150, 250, 150, 20);
          citf.setEditable(false);
  
          cib=new Button("Compound Interest");
          cib.setBounds(240,400,130,50);
          cib.addActionListener(this);
  
          al=new Label("Amount of SI:");
          al.setBounds(15,300,200,20);
          atf=new TextField();
          atf.setBounds(150,300,150,20);
          atf.setEditable(false);
  
          ab=new Button("Amount of SI");
          ab.setBounds(20,400,80,50);
          ab.addActionListener(this);
  
          al1=new Label("Amount of CI:");
          al1.setBounds(300,300,200,20);
          atf1=new TextField();
          atf1.setBounds(390, 300, 150, 20);
          atf1.setEditable(false);
  
          ab1=new Button("Amount of CI");
          ab1.setBounds(390,400,80,50);
          ab1.addActionListener(this);
  
  
          add(pl);
          add(ptf);
  
          add(rtf);
          add(rl);
  
          add(ttf);
          add(tl);
  
          add(sitf);
          add(sil);
          add(sib);
  
          add(ab);
          add(atf);
          add(al);
  
          add(ab1);
          add(atf1);
          add(al1);
  
          add(cib);
          add(citf);
          add(cil);
          setSize(600,600);
          setLayout(null);
          setVisible(true);
      }
      @Override
      public void actionPerformed(ActionEvent e) {
          String s1=ptf.getText();
          String s2=rtf.getText();
          String s3=ttf.getText();
          BigDecimal p=new BigDecimal("s1");
          BigDecimal r=new BigDecimal("s2");
          BigDecimal t=new BigDecimal("s3");
          BigDecimal si=new BigDecimal("0");
          BigDecimal a1=new BigDecimal("0");
          BigDecimal a11=new BigDecimal("0");
          BigDecimal b=new BigDecimal("");
          BigDecimal h=new BigDecimal("100");
          BigDecimal c=new BigDecimal("");
          BigDecimal i=new BigDecimal("1");
          BigDecimal d=new BigDecimal("0");
          BigDecimal j=new BigDecimal("0");
          BigDecimal g=d.subtract(p);
          if(e.getSource()==sib){
              b=p.multiply(r).multiply(t).divide(h);
          }else if(e.getSource()==cib){
              c=i.add(r).divide(h);
              j=c.pow(intValue(t));
              d=p.multiply(j);
              si=p.multiply(t).multiply(r).divide(h);
              a1=p.add(d);
          }else if(e.getSource()==ab){
              si=p.multiply(t).multiply(r).divide(h);
              a1=p.add(d);
          }else if(e.getSource()==ab1){
              c=i.add(r).divide(h);
              j=c.pow(intValue(t));
              d=p.multiply(j);
              si=p.multiply(t).multiply(r).divide(h);
              a1=p.add(d);
              a11=d.subtract(p);
          }
          String sit=String.valueOf(si);
          sitf.setText(String.valueOf(si));
          String at=String.valueOf(a1);
          atf.setText(at);
          String at1=String.valueOf(a11);
          atf1.setText(String.valueOf(a11));
          String cit=String.valueOf(d);
          citf.setText(String.valueOf(d));
      }
      public static void main(String[] args) {
          // TODO code application logic here
          new SI();
      }
  }
  </code></pre>
  
  <p>This Applet is not working. When I click the button, it throws an error. this error started after I changed all double to BigDecimal. Please help me out. I am stuck here from many days. What is the mistake here. I do not have much idea about BigDecimal. I am new to it. please help me out. Why does it throw an error?</p>