JAVA PROBLEM-SOLVING NO.1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JAVA PROBLEM-SOLVING NO.1

Problem No. 1 Write a program that determines the additional state tax owed by the employee. The State charges a 4% tax on net income. Determine net income by subtracting a $500 allowance for each dependent from gross income. Your program should read gross income, number of dependents, and the tax amount already deducted. It should then compute the actual tax owed and print the difference between tax owed and tax deducted followed by the message SEND CHECK or REFUND, depending on whether the difference is positive or negative.

21st Apr 2022, 2:09 AM
Eyy
8 Answers
+ 1
If this is a homework assignment, write it yourself. This is a teaching site, not a programmer for hire site.
21st Apr 2022, 2:30 AM
John Wells
John Wells - avatar
+ 1
John Wells sorry, but I have the program already, is it just that the program is error hehe
21st Apr 2022, 4:14 AM
Eyy
+ 1
Add after line 38: if (actual_Tax_Owed < 0) System.out.println("REFUND"); else System.out.println("SEND CHECK");
21st Apr 2022, 4:28 AM
John Wells
John Wells - avatar
+ 1
[FIXED] Your code is reading one too many numbers. taxOwed should not be read. It should be netIncome * 0.04.
21st Apr 2022, 4:36 AM
John Wells
John Wells - avatar
+ 1
error after adding if.. else..
21st Apr 2022, 4:43 AM
Eyy
+ 1
PROBLEM FIXED! thank you sir John Wells
21st Apr 2022, 4:51 AM
Eyy
0
سلام
21st Apr 2022, 4:54 PM
ND BI