Computer Science, asked by angel224pallupatta, 1 year ago

Write a program by using class Employee to accept basic pay of an employee. Calculate the allowances/deductions using scanner as given below:
Dearness Allowance (DA) = 30% of basic pay
House Rent Allowance (HRA) = 15% of basic pay
Provident Fund (PF) = 12.5% of basic pay
Gross Pay = Basic Pay + DA + HRA
Net Pay = Gross Pay – PF
Find and print the gross and net pay.

Answers

Answered by Anonymous
139

Answer:

a program in java:-

public class employee

{

public static void main(double salary)

{

double allowance=30/100*salary;

double rent =15/100*salary;

double pf=12.5/100*salary;

double gross=salary+allowance+rent;

double net=salary-pf

System.out.println("gross pay=Rs."+gross);

System.out.println("net pay=Rs."+net)'

}

}

HOPING TO HELP YOU****

Answered by phool93
77

Answer:

import java.util.Scanner;

public class Employee

{

   public static void main(String args[])

   {

       Scanner sc = new Scanner(System.in);

       System.out.println("Enter Basic pay of Employee");

       float basic_pay = sc.nextFloat();

       double DA = ((30.0/100) * basic_pay) + basic_pay;

       double HRA = ((15.0/100) * basic_pay) + basic_pay;

       double PF = ((12.5/100) * basic_pay) + basic_pay;

       double gross_pay = basic_pay + DA + HRA;

       double net_pay = gross_pay - PF;

       System.out.println("The Gross Pay is: "+gross_pay);

       System.out.println("The Net Pay is: "+ net_pay);

   }

}

Explanation:

Similar questions