Grade Average Calculator using Java

0
154

This tutorial will teach you on how you can create a “ Grade Average Calculator using Java”J with Netbeans IDE. This program will calculate the Grade Average by Sum the Prelim, Midterm, and Final Grade and Divide it by 3.

Related Article: Basic calculator Using Java with GUI

Also, uses an “If Function Statement” to identify the grade average if it is Passed or Failed. The elements of the JFrame form compose of jTextField, jLabel, and jButton. Please follow all the steps to complete this tutorial

Grade Average Calculator Using Java Steps

  1. Create a new JFrame Form and Design it the same with the image below.

2. Double click your jButton and Insert the following codes below.

  1. try{
  2. double average;
  3. double prelim = Double.parseDouble(jTextField1.getText());
  4. double midterm = Double.parseDouble(jTextField2.getText());
  5. double finalg = Double.parseDouble(jTextField3.getText());
  6. average = (prelim + midterm + finalg) / 3;
  7. jTextField4.setText(Double.toString(average));
  8. if (Double.parseDouble(jTextField4.getText()) <= 74.4){
  9. jTextField5.setText("Failed!");
  10. }else{
  11. jTextField5.setText("Passed!");
  12. }
  13. }catch(Exception e){
  14. JOptionPane.showMessageDialog(null, e);
  15. }

3. Run your program and the output should look like the image below.

For more information, feel free to leave your comment below, use the contact page of this website or use my contact information.
Email: [email protected] | Cell. No.: 09468362375

 

Facebook Comments
(Visited 189 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here