Answer to Question #320696 in Java | JSP | JSF for Kochu

Question #320696

Program to find the total salary by hand of an Employee


Class 1 Get basic pay, deduction, and bonus from the console.


Class 2 Calculate hra (5% of basic pay) and pf (20% of basic pay).


Class 3 Find the total salary (basicpay+hra-pf-deduction+bonus) and get the salary slip


Salary slip should contains :- basic pay, deduction, hra, pf, bonus and total salary by hand.

1
Expert's answer
2022-03-30T07:39:06-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        double basicPay = in.nextDouble();
        double deduction = in.nextDouble();
        double bonus  = in.nextDouble();

        double hra = basicPay * 0.05;

        double pf = basicPay * 0.2;

        double totalSalary = basicPay + hra - pf - deduction + bonus;

        System.out.println(     "basic pay: " + basicPay +
                                "\ndeduction: " + deduction +
                                "\nhra: " + hra +
                                "\npf: " + pf +
                                "\nbonus: " + bonus +
                                "\n total salary: " + totalSalary);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS