SOBAN'S BLOGS
This is very usefull Blog
Search This Blog
Saturday, August 7, 2010
SOURCE CODE OF CALCULATOR IN JAVA
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.lang.*;
class CL implements ActionListener
{
Frame F1;
TextField T1;
Button B_0,B_1,B_2,B_3,B_4,B_5,B_6,B_7,B_8,B_9,B_10;
Button B_a,B_s,B_mul,B_div,B_rem,B_neg,B_AC,B_sqrt,B_eq;
Button B;
double preval,curval,result;
int ch;
public void initial()
{
F1=new Frame("CALCULATOR");
F1.setSize(300,300);
F1.setResizable(false);
F1.setLayout(null);
T1= new TextField();
T1.setBounds(50,50,100,20);
F1.add(T1);
B_0=new Button("0");
B_0.setBounds(20,80,30,20);
F1.add(B_0);
B_0.addActionListener(this);
B_1=new Button("1");
B_1.setBounds(60,80,30,20);
F1.add(B_1);
B_1.addActionListener(this);
B_2=new Button("2");
B_2.setBounds(100,80,30,20);
F1.add(B_2);
B_2.addActionListener(this);
B_3=new Button("3");
B_3.setBounds(20,120,30,20);
F1.add(B_3);
B_3.addActionListener(this);
B_4=new Button("4");
B_4.setBounds(60,120,30,20);
F1.add(B_4);
B_4.addActionListener(this);
B_5=new Button("5");
B_5.setBounds(100,120,30,20);
F1.add(B_5);
B_5.addActionListener(this);
B_6=new Button("6");
B_6.setBounds(20,160,30,20);
F1.add(B_6);
B_6.addActionListener(this);
B_7=new Button("7");
B_7.setBounds(60,160,30,20);
F1.add(B_7);
B_7.addActionListener(this);
B_8=new Button("8");
B_8.setBounds(100,160,30,20);
F1.add(B_8);
B_8.addActionListener(this);
B_9=new Button("9");
B_9.setBounds(20,200,30,20);
F1.add(B_9);
B_9.addActionListener(this);
B_10=new Button(".");
B_10.setBounds(60,200,30,20);
F1.add(B_10);
B_10.addActionListener(this);
B_a=new Button("+");
B_a.setBounds(180,80,30,20);
F1.add(B_a);
B_a.addActionListener(this);
B_s=new Button("-");
B_s.setBounds(220,80,30,20);
F1.add(B_s);
B_s.addActionListener(this);
B_mul=new Button("*");
B_mul.setBounds(180,120,30,20);
F1.add(B_mul);
B_mul.addActionListener(this);
B_div=new Button("/");
B_div.setBounds(220,120,30,20);
F1.add(B_div);
B_div.addActionListener(this);
B_rem=new Button("%");
B_rem.setBounds(180,160,30,20);
F1.add(B_rem);
B_rem.addActionListener(this);
B_neg=new Button("-/+");
B_neg.setBounds(220,160,30,20);
F1.add(B_neg);
B_neg.addActionListener(this);
B_AC=new Button("AC");
B_AC.setBounds(180,200,30,20);
F1.add(B_AC);
B_AC.addActionListener(this);
B_sqrt=new Button("sqrt");
B_sqrt.setBounds(220,200,30,20);
F1.add(B_sqrt);
B_sqrt.addActionListener(this);
B_eq=new Button("=");
B_eq.setBounds(180,240,60,20);
F1.add(B_eq);
B_eq.addActionListener(this);
F1.show();
}
public void actionPerformed(ActionEvent e)
{
Button B =new Button();
B=(Button)e.getSource();
if(e.getSource()==B_0)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_1)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_2)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_3)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_4)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_5)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_6)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_7)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_8)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_9)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_10)
{
T1.setText(T1.getText()+B.getLabel());
}
if(e.getSource()==B_a)
{
curval=Double.parseDouble(T1.getText());
preval=curval;
curval=0;
T1.setText("");
ch=0;
}
if(e.getSource()==B_s)
{
curval=Double.parseDouble(T1.getText());
preval=curval;
curval=0;
T1.setText("");
ch=1;
}
if(e.getSource()==B_mul)
{
curval=Double.parseDouble(T1.getText());
preval=curval;
curval=0;
T1.setText("");
ch=2;
}
if(e.getSource()==B_div)
{
curval=Double.parseDouble(T1.getText());
preval=curval;
curval=0;
T1.setText("");
ch=3;
}
if(e.getSource()==B_rem)
{
curval=Double.parseDouble(T1.getText());
preval=curval;
curval=0;
T1.setText("");
ch=4;
}
if(e.getSource()==B_AC)
{
T1.setText("");
curval=0;
preval=0;
result=0;
}
if(e.getSource()==B_sqrt)
{
if(curval<0)
{
T1.setText("Square of negative not possible");
}
else
{
curval=(double)Math.sqrt(curval);
T1.setText(Double.toString(curval));
}
}
if(e.getSource()==B_eq)
{
switch(ch)
{
case 0:curval=Double.parseDouble(T1.getText());
result=preval+curval;
break;
case 1:curval=Double.parseDouble(T1.getText());
result=preval-curval;
break;
case 2:curval=Double.parseDouble(T1.getText());
result=preval*curval;
break;
case 3: curval=Double.parseDouble(T1.getText());
result=preval/curval;
break;
case 4: curval=Double.parseDouble(T1.getText());
result=preval%curval;
break;
}
T1.setText(Double.toString(result));
curval=0;
preval=0;
}
}
}
class Calcolator
{
public static void main(String avgs[])
{
CL cl1 =new CL();
cl1.initial();
}
}
FREE RELIANCE GPRS
Frendz believe me it is working
for me. One day i forgot to
change TaTA DOCOMO sim. And i
was using Relience sim when i
was open internet then it was
opend succesfull oN
TATADOCOMO internet settings.
Go to settings of acces point
and creat APN :
TATA.DOCOMO.INTERNET
HOMEPAGE : blank
proxy ip: blank
port : blank
NOW TRY TO OPEN INTERNET BY
Relience Sim With Tatadocomo
GpRS SETTINGS
plz maintain balance Rs. 1/-IF ITS NOT WORK FOR U THEN DO THIS WITH RELIANCE
send sms> FIVEGB to 55454.
Note:this trick working some
states only.Perform this trick at
low balance only
for me. One day i forgot to
change TaTA DOCOMO sim. And i
was using Relience sim when i
was open internet then it was
opend succesfull oN
TATADOCOMO internet settings.
Go to settings of acces point
and creat APN :
TATA.DOCOMO.INTERNET
HOMEPAGE : blank
proxy ip: blank
port : blank
NOW TRY TO OPEN INTERNET BY
Relience Sim With Tatadocomo
GpRS SETTINGS
plz maintain balance Rs. 1/-IF ITS NOT WORK FOR U THEN DO THIS WITH RELIANCE
send sms> FIVEGB to 55454.
Note:this trick working some
states only.Perform this trick at
low balance only
Friday, August 6, 2010
Reliance Active new SMS Pack rates at old rates of 11 rps at 1 rps/day plan
hey frnds u all know that reliance has increased their sms rates and all other plan rates
here i hd come with a trick to activate the sms pack with the old rates of the reliance sms
pack.u can enjoy the sms packs with the old rates of 11rs. plan and 1rs/day. plan
11rs. plan
in this plan u can send message with one paise per sms cost
To activate this plan just type
ACT SMS11 and send it to 53739(tollfree)
and u shoul have atleast 15 rs. so that this service will b activated otherwise it will not b activated
1 rs./day plan
in this plan u can send unlimited messages at 1rs./day cost
To activate this plan just type
ACT SMSDD and send it to 53739(tollfree)
and for this u should have atlest 5rs. so that this service will b activated otherwise it will not b activated.
100 % working trick.
try and post me that working for u or nt.......njoy
here i hd come with a trick to activate the sms pack with the old rates of the reliance sms
pack.u can enjoy the sms packs with the old rates of 11rs. plan and 1rs/day. plan
11rs. plan
in this plan u can send message with one paise per sms cost
To activate this plan just type
ACT SMS11 and send it to 53739(tollfree)
and u shoul have atleast 15 rs. so that this service will b activated otherwise it will not b activated
1 rs./day plan
in this plan u can send unlimited messages at 1rs./day cost
To activate this plan just type
ACT SMSDD and send it to 53739(tollfree)
and for this u should have atlest 5rs. so that this service will b activated otherwise it will not b activated.
100 % working trick.
try and post me that working for u or nt.......njoy
Subscribe to:
Posts (Atom)