我似乎无法弄清楚我们的问题是什么。pph 和两者在不同的重载中都等于不同的值。我不确定我做错了什么。我看不出这些值是如何相同的。
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;
}
}