Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Same proble but done different...HELP
#1
I had to do the problem useing the GOSUB command, but the dam
Fedral tax will not work now...Please help..


Thanks'

CLS
GOSUB A100.INPUT.DATA
GOSUB B100.GROSS.PAY
GOSUB B200.GROSS.PAY.ROUNDED
GOSUB B300.FEDRAL.WITHOLDING.TAX
GOSUB B400.FEDRAL.TAX.ROUNDED
GOSUB B500.NET.PAY
GOSUB C100.PRINT.DATA
GOSUB D100.WRAP.UP
END
REM*************************************************************************
REM INPUT DATA
REM*************************************************************************
A100.INPUT.DATA:
CLS
PRINT " PLEASE ENTER DATA AS NEEDED"
PRINT
PRINT
INPUT "EMPLOYEE NUMBER=============================>", EMPLOYEE.NUMBER
INPUT "NUMBER OF DEPENDENTS========================>", NUMBER.OF.DEPENDENTS
INPUT "RATE OF PAY=================================>", RATE.OF.PAY
INPUT "HOURS WORK==================================>", HOURS.WORK
RETURN
REM*************************************************************************
REM GROSS PAY
REM*************************************************************************
B100.GROSS.PAY:
GROSS.PAY = RATE.OF.PAY * HOURS.WORK
RETURN
REM*************************************************************************
REM GROSS PAY ROUNDED
REM*************************************************************************
B200.GROSS.PAY.ROUNDED:
GROSS.PAY = INT((GROSS.PAY + .005) * 100) / 100
RETURN
REM*************************************************************************
B300.FEDRAL.WITHOLDING.TAX:
FEDRAL.WITHOLDING.TAX = .26 * (GROSS.PAY - NUMBER.OF.DEPENDENTS * 40.46)
RETURN
REM*************************************************************************
REM FEDRAL WITHOLDING TAX ROUNDED
REM*************************************************************************
B400.FEDRAL.TAX.ROUNDED:
FEDRAL.WITHOLDING.TAX = INT((FEDRAL.WHITHOLDING.TAX + .005) * 100) / 100
RETURN
REM*************************************************************************
REM NET PAY
REM*************************************************************************
B500.NET.PAY:
NET.PAY = GROSS.PAY - FEDRAL.WITHOLDING.TAX
RETURN
REM*************************************************************************
PRINT "GROSS.PAY===================================>", GROSS.PAY
PRINT "FEDRAL WITHOLDING TAX=======================>", FEDRAL.WITHOLDING.TAX
PRINT "NET PAY=====================================>", NET.PAY
RETURN
REM*************************************************************************
D100.WRAP.UP:
PRINT
PRINT " END OF JOB:",
RETURN
REM PRINT DATA
REM*************************************************************************
C100.PRINT.DATA:
PRINT
PRINT
oseph L. Gelsomino
Reply
#2
AAAAAAHHH!!!!

Untested:
Code:
INPUT "NUMBER OF DEPENDANTS:  ", DEP
INPUT "HOURLY WAGES:                 ", WAGES
INPUT "HOURS WORKED:                ", HOURS

GROSS = WAGES * HOURS
IF GROSS - INT(GROSS) >= 0.5 THEN GROSS = int(GROSS) + 1
GROSS = INT(GROSS)

FEDTAX = .26 * (GROSS - DEP * 40.46)
IF FEDTAX - INT(FEDTAX) >= 0.5 THEN FEDTAX = int(FEDTAX) + 1
FEDTAX = INT(FEDTAX)

NET = GROSS - FEDTAX

PRINT
PRINT "GROSS PAY:  "; GROSS
PRINT "FEDERAL WITHOLDING TAX: "; FEDTAX
PRINT "NET PAY: "; NET

My apologies to the Qmunity; this is the first time I've written a complete program for homework help. I hope you'll all understand.

EDIT:
... And you can use ' instead of REM
Reply
#3
Not asking you to do my homework, only asking why it will not do the Fedral witholding Tax? If you do the work for me how am I suppose to learn...only want to know what it is I am doing wrong with that one calculation or am I doing all the calculation worng.
also we haven't learn to use the IF command as of yet...I have to use the commands the teacher has told us to use...''


Thank You
oseph L. Gelsomino
Reply
#4
I don't know if there are any other problems, but you don't have a line label for
Code:
REM*************************************************************************
PRINT "GROSS.PAY===================================>", GROSS.PAY
PRINT "FEDRAL WITHOLDING TAX=======================>", FEDRAL.WITHOLDING.TAX
PRINT "NET PAY=====================================>", NET.PAY
RETURN
but at the bottom you have a line label that does nothing
Code:
C100.PRINT.DATA:
PRINT
PRINT
I'm surprised that this doesn't give you a GOSUB without RETURN error.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#5
you put witholding and whitholding.
you have to pick one (probably witholding Smile )
Reply
#6
:|

If you would have stuck to the program I posted, you wouldn't have had this problem as it clearly said "federal.witholding.tax"

:normal:
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#7
Code:
B400.FEDRAL.TAX.ROUNDED:
FEDRAL.WITHOLDING.TAX = INT((FEDRAL.WHITHOLDING.TAX + .005) * 100) / 100

There's the problem right there, as Cha0s pointed out. Just a typo.

Federal.Whitholding.tax (spelled wrong) is not set to anything, so when the program encounters it, it thinks it's 0, so this line will always set Federal.Witholding.Tax = INT((0+.005)*100)/100 = INT((.005)*100)/100 = INT(.5)/100 = 0/100 = 0

*peace*

Meg.
Reply
#8
Problem solved. All's well. Good luck on your homework Smile
Reply
#9
the final output still isn't right.. it reads...
Gross pay=====1000
fedral witholding tax==2.38
net pay====997.62

should read

1000
238.96
761.04

this is with the input of..

123===employee number
2=====number of dependents
12.50===rate of pay
80===hours work

I still have something wrong somewhere..NEED HELP..this is now driveing me nuts..

Thank You
oseph L. Gelsomino
Reply
#10
You are off by a factor of about 100. Make sure this line
Code:
FEDRAL.WITHOLDING.TAX = INT((FEDRAL.WHITHOLDING.TAX + .005) * 100) / 100
still has the * 100 in it. If it does, post your new code, so we check it.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)