-3
        usersIncome = InputOutput.DisplayTaxDue(double userIncome, double taxDue, double taxRate, double flatRate);
        Console.WriteLine(" Your income is : {0:C} ", usersIncome );
        Console.WriteLine(" Your tax due is : {0:C} ", taxDue);    
        Console.WriteLine(" Your income is : {0} ", taxRate );
        Console.WriteLine(" Flat Rate is : {0} ",  flatRate);

在每个左括号和右括号后,我都会收到无效的令牌。

4

1 回答 1

3

我怀疑你直接在一个类中编写了这段代码;指令只能出现在方法中,不能直接出现在类中:

class YourClass
{
    public void YourMethod()
    {
        usersIncome = InputOutput.DisplayTaxDue(userIncome, taxDue, taxRate, flatRate);
        Console.WriteLine(" Your income is : {0:C} ", usersIncome );
        Console.WriteLine(" Your tax due is : {0:C} ", taxDue);    
        Console.WriteLine(" Your income is : {0} ", taxRate );
        Console.WriteLine(" Flat Rate is : {0} ",  flatRate);
    }
}

另外,当你调用一个方法时,你不指定参数的类型;它们已经在声明中指定。

于 2013-10-26T23:17:11.540 回答