By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,553 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,553 IT Pros & Developers. It's quick & easy.

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

P: 1
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
2 Weeks Ago #1
Share this Question
Share on Google+
2 Replies

dev7060
Expert 100+
P: 336
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.
2 Weeks Ago #2

P: 37
The following code snippet will full fill your requirement :

Expand|Select|Wrap|Line Numbers
  1. if(salary>=20000)
  2.         {
  3.             deduction=salary*2/100;
  4.             netpay=salary-deduction;
  5.             System.out.println("User Netpay "+netpay);
  6.         }
  7.         else{
  8.             deduction=salary*2/100;
  9.             netpay=salary-deduction;
  10.             System.out.println("User Netpay "+netpay);
  11.         }
  12.  
1 Week Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.