please answer in java language
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:
- Formula to calculate net salary is given. Using the formula, the program is Solved.
Output is attached.
Attachments:
Similar questions
Social Sciences,
3 months ago
English,
3 months ago
Social Sciences,
10 months ago
Math,
10 months ago
Math,
10 months ago