I am trying to write a program to give total and average on commissions. Between certain amounts the commission is more but I can't seem to figure out how to make it apply right. It isn't keeping between the ranges I set, example if I put in value 2500.00 it applys the 10% and stops instead of going to the 20% and stopping. Not sure how to make it stay in the range to apply the right percentage.
/
repeat {
print("Enter your sales amount: ", terminator: "")
let n_str = input() /
let t = NSString(string: n_str) /
sales = t.doubleValue
if sales <= 999.99 {
sales = sales * 0.05
} else if sales >= 1000.00 - 1999.99 {
sales = sales * 0.10
} else if sales >= 2000.00 - 2999.99 {
sales = sales * 0.20
} else if sales >= 3000.00 - 3999.99 {
sales = sales * 0.30
} else if sales >= 4000.00 - 4999.99 {
sales = sales * 0.40
} else if sales >= 5000.00 {
sales = sales * 0.50
}
total += sales /
/
count += 1
}while count < numSales