我不确定我应该如何命名我的问题。我正在尝试编写一个询问属性值的程序。然后它取该值并将其乘以 60% 以给出评估值。例如,如果一英亩土地的价值为 10,000 美元,则其评估价值为 6,000 美元。每 100 美元的评估价值需缴纳 64 美分的财产税。评估为 6,000 美元的一英亩土地的税为 38.40 美元。我必须设计一个模块化程序,询问一块财产的实际价值并显示评估价值和财产税。这是我到目前为止所拥有的。
{
static void Main(string[] args)
{
double propertyValue = 0.0;
double assessTax = 0.0;
double propertyTax = 0.0;
getValue(ref propertyValue);
Tax(ref propertyValue, propertyTax, assessTax);
showOutput(ref propertyTax, assessTax, propertyValue);
}///End Main
static void showOutput(ref double propertyValue, double assessTax, double propertyTax)
{
Console.WriteLine("Your Entered Property Value was {0, 10:C}", propertyValue);
Console.WriteLine("Your Assessment Value is {0, 10:C}", assessTax);
Console.WriteLine("Your Property Tax is {0, 10:C}", propertyTax);
}///End showOutput
static void getValue(ref double propertyValue)
{
Console.WriteLine("Please Enter Property Value");
while (!double.TryParse(Console.ReadLine(), out propertyValue))
Console.WriteLine("Error, Please enter a valid number");
}///End getValue
static void Tax(ref double propertyValue, double assessTax, double propertyTax)
{
assessTax = propertyValue * 0.60;
propertyTax = (assessTax / 100) * 0.64;
}///End Tax
这是我第一次尝试在 Dreamspark 中写任何东西,所以如果答案很明显,我深表歉意(我有点迷路了)。我在想也许我对财产价值的输入没有被保存。当我尝试运行它时,我得到的财产价值是 0.00 美元,评估价值是 0.00 美元,财产税是 10,000 美元。任何直接的答案或指向指南的链接,以便我自己修复它,我们将不胜感激。