我似乎無法確定問題出在哪裏。 pph,並且在不同的過載情況下都等於不同的值。我不確定我做錯了什麼。我不明白這些值是如何相同的。錯誤類型'Pay'已經定義了一個名爲'ComputePay'的成員,其參數類型相同
public class Pay
{
public double ComputePay(double h,double pph,double with)
{
double net = 0;
try
{
double gross = h * pph;
net = gross - with;
}
catch (FormatException)
{
Console.WriteLine("Hour's cannot be less than zero");
}
return net;
}
public double ComputePay(double h, double pph, double with = 0.15)
{
double net = 0;
try
{
double gross = h * pph;
net = gross - with;
}
catch (FormatException)
{
Console.WriteLine("Hour's cannot be less than zero");
}
return net;
}
public double ComputePay(double h, double pph = 5.85, double with = 0.15)
{
double net = 0;
try
{
double gross = h * pph;
net = gross - with;
}
catch (FormatException)
{
Console.WriteLine("Hour's cannot be less than zero");
}
return net;
}
}
謝謝這是我誤讀我的作業 – TheAce 2013-03-11 15:51:55