Sunday, November 7, 2021

Grade Solver Using JOptionPane in Java

Machine Problem

Write a Java program that will ask the user to give grades in prelim, midterm, and endterm  period, and then the program will compute the final grade, and display the results on the screen.

  I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.










Program Listing

Grade_Solver.java

package test;


/*

* Jake Rodriguez Pomperada, MAED-IT, MIT

* www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

* jakerpomperada@gmail.com

* Bacolod City, Negros Occidental Philippines

* November 7, 2021  Sunday  10:03 AM

* Machine Problem

* Write a Java program that will ask the user to give grades in prelim, midterm, and endterm 

* period, and then the program will compute the final grade, and display the results on the screen.

*

** 

*/



import javax.swing.*;

import javax.swing.JOptionPane;


public class Grade_Solver {



public static void main(String args[]) {


final JPanel panel = new JPanel();

String input1,input2,input3;


double prelim=0.00, midterm=0.00;

double endterm=0.00;


double compute=0.00;


String reply="n";


do

{



    JOptionPane.showMessageDialog(panel, "           Grade Solver Using JOptionPane in Java   \n\n"

        + "                              Created By     \n\n"

        + "Prof. Jake Rodriguez Pomperada, MAED-IT, MIT\n\n", "About This Program",

        JOptionPane.INFORMATION_MESSAGE);

    

input1 = JOptionPane.showInputDialog(null,"Enter Prelim Grade :");

prelim=Double.parseDouble(input1);

input2 = JOptionPane.showInputDialog(null,"Enter Midterm Grade :  ");

midterm=Double.parseDouble(input2);


input3 = JOptionPane.showInputDialog(null,"Enter Endterm Grade : ");

endterm=Double.parseDouble(input3);



compute = (prelim * 0.20) + (midterm* 0.30) + (endterm * 0.50);


JOptionPane.showMessageDialog(null,"Final Grade : " + Math.round(compute) );


reply = JOptionPane.showInputDialog(null,"Try Again? (press y or n) ");

}while (reply.matches("y") || reply.matches("Y") );


JOptionPane.showMessageDialog(null,"End of Program"  );



}

}



No comments:

Post a Comment