I've been trying to solve this problem in my class but I cant seem to get the math right.
Using For.. loop, Write a program to fetch the name, salary and the state of 5 employees. Calculate the federal tax, state tax and the net salary for each employee.
statetax = 0
fedtax = 0
employsalary = 0
netsalary = 0
for people in range(5):
employname = input("Please enter employee name: ")
employsalary = int(input("Please enter employee salary: "))
employstate = input("Please enter employee state: ")
if employsalary >= 100000:
fedtax = (employsalary * 20) / 100
else: # employsalary < 100000
fedtax = (employsalary * 15) / 100
if employstate == 'California' or 'Neveda' or 'Arizona' or 'Washington':
statetax = (employsalary * 10) / 100
elif employstate == 'Texas' or 'NewMexico' or 'Alabama':
statetax = (employsalary * 9) / 100
elif employstate == 'NewYork' or 'Illinois' or 'Wisconsin' or 'Delaware':
statetax = (employsalary * 8) / 100
else:
statetax = (employsalary * 12) / 100
netsalary = (employsalary - fedtax - statetax)
print(employname + ' federal tax is: ' +str(fedtax))
print(employname + ' state tax is: ' +str(statetax))
print(employname + ' net salary is: ' +str(netsalary))
for some reason the calculations are not correct when the value of employsalary is multiplied by both 8 and 9 in the two different statements and I cant figure out why. I hope I explained this right. x_x