I am having trouble with this following call, specially the last component:
Console.WriteLine(\"Taxpayer # {0} SSN: {1}, Income is {2:c}, Tax is {3:c}\", i + 1,
No-repro. Using the simple program below, I get valid non-zero result (900
using my values):
internal class Program {
private static int incLimit = 30000;
private static float lowTaxRate = 0.18F;
private static float highTaxRate = 0.30F;
private static void Main(string[] args) {
var result = CalculateTax(5000);
}
public static int CalculateTax(int income) {
int taxOwed;
// If income is less than the limit then return the tax
// as income times low rate.
if (income < incLimit) {
taxOwed = Convert.ToInt32(income * lowTaxRate);
}
// If income is greater than or equal to the limit then
// return the tax as income times high rate.
else if (income >= incLimit) {
taxOwed = Convert.ToInt32(income * highTaxRate);
}
else taxOwed = 0;
return taxOwed;
}
}