PLEASE USE JUST BASIC COMPILER ONLY : Using For..next loop, Write a program to f
ID: 3757643 • Letter: P
Question
PLEASE USE JUST BASIC COMPILER ONLY :
Using For..next loop, Write a program to fetch the name, salary and the state of the employee. Calculate the federal tax, state tax and the net salary for each employee. Use the following criteria:
To calculate the federal tax, use the following criteria:
If the salary is greater than 100,000 then calculate the federal tax at 20 percent.
Otherwise calculate the federal tax at 15%.
To calculate the state Tax, use the following criteria:
If the employee is from California, Nevada, Arizona, or Washington calculate the state tax at 10%
If the employee is from Texas, NewMexico, Or Alabama, then calculate the state tax at 9%
If the employee is from Newyork, Illinois, Wisconsin Or Delaware then calculate the state tax at 8%
Otherwise calculate the state tax at 12%
Calculate and display the netsalary.
Repeat the above instructions for 6 employees.
Hint1: You can use the For loop.
Hint2: Each time the computer goes through the loop, it calculates the salary of one employee.
Explanation / Answer
FOR k=1 TO 99
PRINT"Enter 'done' when if finished."
INPUT "Please enter employee surname: "; lastName$
IF lastName$="done" THEN EXIT FOR
INPUT "Please enter employee first name: "; firstName$
INPUT "Please enter your gross income for this year: "; income
taxPayer$= firstName$+" "+lastName$
IF income<100000 THEN
fedRate=.15
ELSE
fedRate=.20
END IF
[selectState]
PRINT "If your residence is CA, NV AZ or WA, please enter 1."
PRINT "If your residence is TX, NM, or AL, please enter 2."
PRINT "If your home is NY, IL, WI, or DE, please enter 3."
PRINT "All other states, District of Columbia, or Puerto Rico, please enter 4."
INPUT "What is your state identifier? "; homeState
homeState=INT(homeState) 'eliminates users who are messing with us.
IF homeState<1 OR homeState>4 THEN
NOTICE "Error! Error! ERROR!"; CHR$(13);_
"You have made an invalid selection!"; CHR$(13);_
"Please select 1 thru 4!"
GOTO [selectState]
END IF
IF homeState=1 THEN stateRate=.1
IF homeState=2 THEN stateRate=.09
IF homeState=3 THEN stateRate=.08
IF homeState>4 THEN stateRate=.12
PRINT
PRINT taxPayer$+" your federal income tax is: $"; income*fedRate
PRINT taxPayer$+" your state income tax is: $"; income*stateRate
PRINT "Your total tax liability is: $"; (income*fedRate)+(income*stateRate)
PRINT "Your net salary, after taxes, is: $"; income-((income*fedRate)+(income*stateRate))
PRINT
NEXT k
PRINT
PRINT "End of the program."
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.