please tell with explanation
Attachments:
Answers
Answered by
4
Required Answer:-
Question:
- Write a program to calculate the net salary of an employee.
Solution:
Here is the program.
import java.util.*;
public class NetSalary {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
double basic, da, hra, cta, pf;
double epf, gross, net=0;
System.out.print("Enter basic: ");
basic=sc.nextDouble();
sc.close();
da=basic*40.0/100.0;
hra=basic*10.0/100.0;
cta=basic*5.0/100.0;
pf=basic*8.33/100.0;
epf=basic*1.67/100.0;
gross=basic+da+hra+cta;
net=gross-(pf+epf);
System.out.println("Net Salary: "+net);
}
}
Explanation:
- Net salary is calculated by using the given formula. Using this formula, the problem is solved.
Output is attached.
Attachments:
Aryan0123:
Nice
Similar questions