Answer to Question #266839 in Java | JSP | JSF for Dexter

Question #266839

Scanner Class


Write a JAVA program that will compute for the net income of a particular employee. You have to accept name, position, and number of days worked. The position has three categories: if Manager, rate per day is P500; if Supervisor, P400; if Employee, P300. Then after accepting the rate per day, compute gross = rate per day * no. of days worked, compute for the bonus, if gross is >= 8000, bonus = 1000; if gross>= 5000, bonus = 750; if gross >= 3000, bonus = 500; if less, bonus = 0; compute for the deductions: SSS is always 10% of gross; Medicare is always P100; and TAX, if gross >= 7000, tax = 15% of gross; if gross >= 4000, tax = 10% of gross, if gross >=2000, tax = 5% of gross. Then, compute for Net Income = gross + bonus – total deduction. Then, display the net income.



1
Expert's answer
2021-11-16T18:37:19-0500


package employee;


import java.util.Scanner;




public class Employee {


    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter the name of the employee:\n");
        String name= scan.nextLine();
        System.out.println("Enter the position of the employee:\n");
        String position= scan.nextLine();
        
        System.out.println("Enter the number of days of the employee:\n");
        double number_of_days = scan.nextDouble();
        
        
        double gross = 0;
        if(position=="Manager"){
            gross = 500 * number_of_days;
        }
        
        else if(position=="Supervisor"){
            gross = 400 * number_of_days;
        }
        
        else if(position=="Employee"){
            gross = 300 * number_of_days;
        }
        double bonus = 0;
        if(gross>=8000){
            bonus = 1000;
        }
        
        else if(gross>=5000 && gross<8000){
            bonus = 750;
        }
        
        else if(gross>=3000 && gross<5000){
            bonus = 500;
        }
        else{
            bonus = 0;
        }
        double total_deductions = 0;
        double sss = gross * 0.1;
        double medicare = 100;
        
        
        double tax = 0;
        
        if(gross>=7000){
            tax = gross * 0.15;
        }
        else if(gross>= 4000 && gross<7000){
            tax = gross * 0.1;
        }
        
        else if(gross>= 2000 && gross<4000){
            tax = gross * 0.05;
        }
       double totaldeduction = tax + sss + medicare;
       double NetIncome = gross + bonus - totaldeduction; 
        System.out.println("Net Income is:\n"+NetIncome);
    }
    
}

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