Write a program that will ask the user to enter his/her salary. 2% will be deducted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yehah
    New Member
    • Nov 2020
    • 1

    Write a program that will ask the user to enter his/her salary. 2% will be deducted

    Write a program that will ask the user to
    enter his/her salary.
    2. 2% will be deducted if the salary is
    above 20,000.00, otherwise 1% will be
    deducted.
    3. Display the net pay or take-home pay of
    the user.
    netpay = salary - deduction
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 655

    #2
    Write a program that will ask the user to
    enter his/her salary.
    2. 2% will be deducted if the salary is
    above 20,000.00, otherwise 1% will be
    deducted.
    3. Display the net pay or take-home pay of
    the user.
    netpay = salary - deduction
    You're going to need to write some code for this.

    Comment

    • Ishan Shah
      New Member
      • Jan 2020
      • 47

      #3
      The following code snippet will full fill your requirement :

      Code:
      if(salary>=20000)
      	    {
      	        deduction=salary*2/100;
      	        netpay=salary-deduction;
      	        System.out.println("User Netpay "+netpay);
      	    }
      	    else{
      	        deduction=salary*2/100;
      	        netpay=salary-deduction;
      	        System.out.println("User Netpay "+netpay);
      	    }

      Comment

      Working...