Saturday, 27 August 2016

Java Program

GUI Based Payroll System Java Program


import javax.swing.JOptionPane;
    class salary{
        public static void main(String[]args) throws Exception{
            
            String pay = JOptionPane.showInputDialog("Enter Basic Pay");
            int basicpay = Integer.parseInt(pay);
            
                    JOptionPane.showMessageDialog(null, "Basic Salary: " +  pay);
            
            int houserent = basicpay * 25 / 100;
            int conveyance = basicpay * 15 / 100;
            int medical = basicpay * 35 / 100;
            int governance = basicpay * 5 / 100;
            int total_salary = basicpay + houserent + conveyance + medical + governance;
            
            int tax = basicpay * 14 / 100;
            int zakat = basicpay * 25 / 100;
            int gross_pay = tax + zakat;
            
            int net_salary = total_salary - gross_pay;
                        
        JOptionPane.showMessageDialog(null, "ALLOUNCES " + 
                    "\n House rent 35% : " + houserent +
                    "\n Conveyance is 15% : " + conveyance +
                    "\n Medical Allounce 35% : " + medical + 
                    "\n Governance Allounce 5% : " + governance +
                    "\n Total Salary is : " + total_salary );
        
        JOptionPane.showMessageDialog(null, "DEDUCTIONS " + 
                    "\n Government Tax : " + tax + "\n Annual Zakat :"                                       + zakat + "\n Total Deductions " + gross_pay);

        JOptionPane.showMessageDialog(null, "Net Salary " + net_salary );
        }
    }

/*given * 100 divide total == percentage
    
    */

No comments:

Post a Comment