我已經查看了此問題的其他答案,但我確實不太瞭解編碼以瞭解他們在說什麼。我在一個介紹課,知道最低限度。我應該打個車的價格計算,使用方法,找出哪些是選擇規範得到的總價爲汽車,但一直收到的瓷磚錯誤:錯誤:沒有給出的參數對應於所需的形式參數
There is no argument given that corresponds to the required formal parameter
我的代碼是:
這裏發生double totalPrice = 0.0;
//Add each cost
totalPrice += getBasePrice();
totalPrice += getTransmissionPrice();
totalPrice += getWheelsPrice();
totalPrice += getAccessoriesPrice();
//Calculate tax
totalPrice += getTax(totalPrice);
//Display Cost
lblPriceOutput.Text = totalPrice.ToString("C");
}
public double getBasePrice(double typeChoice)
{
typeChoice = 0;
if (rdCar.Checked)
{
typeChoice = 19150;
}
else if (rdTruck.Checked)
{
typeChoice = 29475;
}
else if (rdSUV.Checked)
{
typeChoice = 30595;
}
else if (rdMinivan.Checked)
{
typeChoice = 28155;
}
return typeChoice;
}
您需要雙值傳遞給'totalPrice + = getBasePrice()'。例如。 'totalPrice + = getBasePrice(23000)' – Sameer