Q3.
To Calculate %age using if/else command.
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0); // TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
txtsn.setText("");
txtfn.setText(" ");
txtrn.setText(" ");
txtc.setText(" ");
txte.setText(" ");
txtm.setText(" ");
txtch.setText(" ");
txtco.setText(" ");
txtt.setText(" ");
txtp.setText(" ");
txtg.setText(" ");
txtph.setText(" ");
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
int e =
Integer.parseInt(txte.getText());
int m =
Integer.parseInt(txtm.getText());
int ch = Integer.parseInt(txtch.getText());
int ph =
Integer.parseInt(txtph.getText());
int co =
Integer.parseInt(txtco.getText());
double t,p;
t =(e+m+ch+ph+co);
p =(t)/5 ;
txtt.setText(" "+t);
txtp.setText(" "+p);
if(p>=90){
txtg.setText("A");
}
else
if(p>=70){
txtg.setText("B");
}
else
if(p>=55){
txtg.setText("C");
}
else
if(p>=35){
txtg.setText("D");
}
else
if(p<=35){
txtg.setText("F");
}
}
No comments:
Post a Comment