Java Programing
Java Programing
PROGRAM-1:-addition-
CODE:-
private void jButton1ActionPerformed (java.awt.event.ActionEvent evt)
{
int a=Integer.parseInt (t1.getText());
int b=Integer.parseInt (t2.getText ());
int c=a+b;
t3.setText (""+c);
}
private void jButton4ActionPerformed (java.awt.event.ActionEvent evt)
{
int a=Integer.parseInt (t1.getText ());
int b=Integer.parseInt (t2.getText ());
int c=a/b;
t3.setText (""+c);
}
private void jButton3ActionPerformed (java.awt.event.ActionEvent evt)
{
int a=Integer.parseInt (t1.getText ());
int b=Integer.parseInt (t2.getText ());
int c=a*b;
t3.setText (""+c);
}
CODE:-
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{
int fee=0,tot;
if (radcom.isSelected())
fee=2500;
else if (radart.isSelected())
fee=2000;
else if (radmed.isSelected())
fee=2900;
else if (radnon.isSelected())
fee=2800;
tot=fee;
jTextField3.setText(""+tot);
if(ch1.isSelected())
tot=tot+200;
jTextField3.setText(""+tot);
Program-5:-delete record-
code:-
String pd=new String(pwd1.getPassword());
if(pd.equals("007")){
this.setVisible(false);
new Details().setVisible(true);
}
else{
JOptionPane.showMessageDialog(null,"Invalid Password");
}
}
program-6:-hotel management-
Code-
int a,b,c,d,e,f;
a=Integer.parseInt(t1.getText());
b=Integer.parseInt(t2.getText());
c=Integer.parseInt(t3.getText());
d=Integer.parseInt(t4.getText());
e=Integer.parseInt(t5.getText());
f=Integer.parseInt(t6.getText());
if(one.isSelected()){
amt.setText("2000");
}
if(two.isSelected()){
amt.setText("4000");
}
if(single.isSelected()){
amt.setText("1000");
}
if(dou.isSelected()){
amt.setText("2000");
}
Code:-
private void b6ActionPerformed(java.awt.event.ActionEvent evt)
{
ta1.setText("");
t1.setIcon(new ImageIcon("E:\ravinder\220px-Cristo_Redentor_-
_Rio_de_Janeiro,_Brasil.jpg"));
ta1.append("Christ the Redeemer (Portuguese is an Art Deco.");
}
private void b1ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\index.jpg"));
ta1.append("Tajmahal was built by shahjhan in Agra");
}
private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\ffvgm.jpg"));
ta1.append("Great wall of china is situated in China")
}
private void b3ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\wergter.jpg"));
ta1.append("Petra originally known to the Nabataea’s as Ramus, is a
historical and archaeological city in southern Jordan.");
}
private void b4ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\index.jpg"));
ta1.append("Machu Picchu is a 15th-century Inca citadel situated
on a mountain ridge 2,430 meters (7,970 ft.) above sea level.");
}
private void b5ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\images.jpg"));
ta1.append("The Great Pyramid of Giza is the oldest and largest of
the three pyramids in the Giza pyramid complex bordering what is
now El Giza.");
}
private void b7ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\index.jpg"));
ta1.append("Tajmahal was built by shahjhan in Agra");
program:-9-simple interest-
Code:-
int p,r,t,i,a;
p=Integer.parseInt(t1.getText());
r=Integer.parseInt(t2.getText());
t=Integer.parseInt(t3.getText());
i=p*r*t/100;
t4.setText(""+i);
a=p+i;
t5.setText(""+a);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
}
Program:-10-marks calculator-
Code:-
int sum,phy,che,maths;
String n;
n=(String)t4.getText();
phy=Integer.parseInt(t1.getText());
che=Integer.parseInt(t2.getText());
maths=Integer.parseInt(t3.getText());
sum=phy+che+maths;
t.append("name:"+n+'\n');
t.append("marks:"+sum+'\n');
if(sum>=180&&sum<=300){
t.append("eligible");
}
else{
t.append("not eligible");
}