这是我的计划:
using System;
using static System.Console;
class MoveEstimator
{
static void Main(string[] args)
{
const double BASE_RATE = 250.00;
const double HOUR_RATE = 150.00;
const double COST_MILE = 2.00;
string amtHoursAsString;
double amtHours;
string numMilesAsString;
double numMiles;
double totalOfMove;
Write("Enter amount of hours >> ");
amtHoursAsString = ReadLine();
amtHours = Convert.ToDouble(amtHoursAsString);
Write("Enter number of miles >> ");
numMilesAsString = ReadLine();
numMiles = Convert.ToDouble(numMilesAsString);
totalOfMove = (amtHours * HOUR_RATE) + (numMiles * COST_MILE) + BASE_RATE;
WriteLine( "Your estimated move cost is " + totalOfMove);
return;
}
}
它适用于输入,但程序在它给出输出之前关闭。你可以告诉我,我对此很新。我用一本书来学习它,所以我只想要一个入门级的答案,这样我才能顺利完成。我只需要知道我的WriteLine语句有什么问题。非常感谢你!