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
first of all => should be >=
secondly, &&. ie else if (taxcode == " B " && (salary < 45000))
Name:
Anonymous2010-08-29 0:56
>>1
I'm going to take a shot in the dark because I really don't know this language (is this C#?). I think it's trying to turn " B " (salary => 45000)
" B " (salary < 45000)
into methods, under the assumption that they (were intended to) return boolean values.
Name:
Anonymous2010-08-29 1:00
OP why are you using C#?
Name:
Anonymous2010-08-29 1:03
>>5
Because I'm studying Computing and Math sciences at Uni and thats what we use.
>>12
Proprietary Oracle bullshit isn't any better. In fact, it's worse. Microsoft promised they won't sue you for using a non-Microsoft implementation, while Oracle will sue you if they think you have enough money.
Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Please press enter to exit.");
Woah there, cowboy! Don't they explain escape sequences at the Microsoft Summer Camp?