Name: Anonymous 2010-08-29 0:41
I can't for the life of me figure it out
static void Main(string[] args)
{
string taxcode;
Console.WriteLine("Please enter your taxcode [A/B]: ");
taxcode = Console.ReadLine();
int salary;
Console.WriteLine("Please enter your annual salary ");
salary = Convert.ToInt32(Console.ReadLine());
if (taxcode == " A ")
{
Console.WriteLine("Tax due: " + (salary * 25) / 100);
}
else if (taxcode == " B " (salary => 45000))
{
Console.WriteLine("Tax due: " + (salary * 30) / 100);
}
else if (taxcode == " B " (salary < 45000))
{
Console.WriteLine("Tax due: " + (salary * 33) / 100);
}
}
}
}
Error 1 Method name expected
Error 2 Method name expected
Error 3 A local variable named 'salary' cannot be declared in this scope because it would give a different meaning to 'salary', which is already used in a 'parent or current' scope to denote something else
static void Main(string[] args)
{
string taxcode;
Console.WriteLine("Please enter your taxcode [A/B]: ");
taxcode = Console.ReadLine();
int salary;
Console.WriteLine("Please enter your annual salary ");
salary = Convert.ToInt32(Console.ReadLine());
if (taxcode == " A ")
{
Console.WriteLine("Tax due: " + (salary * 25) / 100);
}
else if (taxcode == " B " (salary => 45000))
{
Console.WriteLine("Tax due: " + (salary * 30) / 100);
}
else if (taxcode == " B " (salary < 45000))
{
Console.WriteLine("Tax due: " + (salary * 33) / 100);
}
}
}
}
Error 1 Method name expected
Error 2 Method name expected
Error 3 A local variable named 'salary' cannot be declared in this scope because it would give a different meaning to 'salary', which is already used in a 'parent or current' scope to denote something else