AVERAGE MARKS , DISTINCSION , GRADE AND TOTAL MARKS USE THE FOLLOWING SCRIPT IN NETBEANS AND CHANGE TEXTFEILD NAME ACORDINGLY
SCRIPT FOR COMPUTE BUTTON
SCRIPT FOR COMPUTE BUTTON
// Declare & Initialise
variable for storing Subject marks
int
english=Integer.parseInt(txtsc.getText());
int maths=Integer.parseInt(txtmaths.getText());
int science=Integer.parseInt(txtsc.getText());
int
history=Integer.parseInt(txthist.getText());
//Compute and set total
marks
int total
=english+maths+science+history;
txttot.setText("
"+total);
//Compute and get Average marks
int average=total/4;
txtavg.setText("
"+average);
//Compute and set Resultand
Grade
if (average>=75)
{txtr.setText("Distinction");
txtg.setText("A");}
else if (average>=60)
{txtr.setText("First
Class");
txtg.setText("B");}
else if (average>=50)
{txtr.setText("Second
Class");
txtg.setText("C");}
else if (average>=40)
{txtr.setText("Average");
txtg.setText("D");}
else
{txtr.setText("Fail");
txtg.setText("F");}
SCRIPT FOR EXIT BUTTON
System.exit(0); // TO EXIT PROGRAM
No comments:
Post a Comment