CGPA TO PERCENTAGE CALCULATOR
Program: To calculate percentage from CGPA
Program Code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code="applet2" width=400 height=200>
</applet>
*/
public class applet2 extends Applet implements ActionListener
{
TextField Name, Reg_no, cgpa,per;
public applet2()
{
setLayout(new GridLayout(4, 2, 10, 15));
setBackground(Color.gray);
Name = new TextField(15);
Reg_no = new TextField(15);
cgpa = new TextField(15);
per=new TextField(15);
cgpa.addActionListener(this);
add(new Label("Enter Your Name"));
add(Name);
add(new Label("Enter Your Registration No."));
add(Reg_no);
add(new Label("Enetr your CGPA"));
add(cgpa);
add(new Label("Your percentage:"));
add(per);
}
public void actionPerformed(ActionEvent e)
{
double fn;
double sn = Double.parseDouble(cgpa.getText());
fn=sn*9;
per.setText(" "+ fn);
}
}
Output:
Download the complete code:- Applet2.rar
Program: To calculate percentage from CGPA
Program Code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code="applet2" width=400 height=200>
</applet>
*/
public class applet2 extends Applet implements ActionListener
{
TextField Name, Reg_no, cgpa,per;
public applet2()
{
setLayout(new GridLayout(4, 2, 10, 15));
setBackground(Color.gray);
Name = new TextField(15);
Reg_no = new TextField(15);
cgpa = new TextField(15);
per=new TextField(15);
cgpa.addActionListener(this);
add(new Label("Enter Your Name"));
add(Name);
add(new Label("Enter Your Registration No."));
add(Reg_no);
add(new Label("Enetr your CGPA"));
add(cgpa);
add(new Label("Your percentage:"));
add(per);
}
public void actionPerformed(ActionEvent e)
{
double fn;
double sn = Double.parseDouble(cgpa.getText());
fn=sn*9;
per.setText(" "+ fn);
}
}
Output:
No comments:
Post a Comment