Marksheet Using GUI Based Input (SWING)
import javax.swing.JOptionPane;
class SwingMarksheet{
public static void main(String[]args) throws Exception{
String a = JOptionPane.showInputDialog("Enter Java Marks");
int java = Integer.parseInt(a);
String s = JOptionPane.showInputDialog("Enter PHP Marks");
int php = Integer.parseInt(s);
String d = JOptionPane.showInputDialog("Enter VB Marks");
int vb = Integer.parseInt(d);
String f = JOptionPane.showInputDialog("Enter C++ Marks");
int cpp = Integer.parseInt(f);
String g = JOptionPane.showInputDialog("Enter Assembly Marks");
int assembly = Integer.parseInt(g);
int total = 500;
int obtained = java + php + vb + cpp + assembly;
int percentage = obtained*100/total;
JOptionPane.showMessageDialog(null, " \n Obtained Marks Are : " + obtained
+ "\n Total Marks Are : " + total
+ " \n Percentage is : " + percentage + "%" );
}
}
No comments:
Post a Comment