出租车计费

{
while (true)
{
double x;
Console.WriteLine("请输入坐车距离");
x = Convert.ToDouble(Console.ReadLine());
if (x <= 3&&x>0)
{
Console.WriteLine("给我8块钱");

}
else if (x > 3 && x <= 5)
{
Console.WriteLine("给我"+(8+(x-3)*1.2)+"块钱");
}
else if (x > 5)
{
Console.WriteLine("给我" + ((8 + 2.4) + (x - 5) * 1.5) + "块钱");
}
else
{
Console.WriteLine("你蒙我呢");
}
















Console.ReadLine();

posted @ 2015-03-28 11:27  耿鹏飞  阅读(177)  评论(0编辑  收藏  举报