Thursday, 1 September 2016

Java Program (Complete Marksheet Using Swing)

COMPLETE MARKSHEET USING SWING PACKAGE


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 b = JOptionPane.showInputDialog("Enter PHP Marks");
            int php = Integer.parseInt(b);
            String c = JOptionPane.showInputDialog("Enter VB Marks");
            int vb = Integer.parseInt(c);
            String d = JOptionPane.showInputDialog("Enter C++ Marks");
            int cpp = Integer.parseInt(d);
            String e = JOptionPane.showInputDialog("Enter Ruby Marks");
            int ruby = Integer.parseInt(e);
           
            int total = 500;
            int obtained = java + php + cpp + vb + ruby;
            int percentage = obtained * 100 / total;
           
            if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <100 && percentage >=80))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got A+ Grade");

            if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <80 && percentage >=70))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got A Grade");

           
           if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <70 && percentage >=60))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got B Grade");

           
           if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <60 && percentage >=50))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got C Grade");

           
           if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <50 && percentage >=40))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got D Grade");


            if(java <40 || php <40 || vb <40 || cpp <40 || ruby <40 || percentage < 40)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Fail");
                                                 
        }
    }

No comments:

Post a Comment