我正在使用視覺工作室2012年,我正在創建一個程序,提示用戶輸入他們的車的車輪數量,他們的車的顏色,里程等。並將顯示「的起點汽車,里程和汽車的顏色,一旦用戶輸入他們的價值。但是,一旦我啓動程序並輸入車輪數量,程序就會終止,不會進入下一步。C#程序運行但終止?
public class Car
{
private int NumbofWheels;
private int Mileage;
private String Color;
private double point;
private double newPoint;
private String owner;
static void Main(string[] args)
{
Console.WriteLine("****************************************");
Console.WriteLine("* WELCOME TO CAR MANAGER *");
Console.WriteLine();
Console.WriteLine("* BY: MOHAMED SHIRE *");
Console.WriteLine("* *");
Console.WriteLine("* *");
Console.WriteLine("* **************************************");
Console.Write("ENTER THE # OF WHEELS OF A CAR: ");
Console.ReadKey();
}
public Car()
{
Mileage = 0;
NumbofWheels = 4;
point = 1000000;
}
public Car(int mile)
{
Mileage = mile;
}
public Car(int n, String c)
{
Mileage = 0;
NumbofWheels = n;
Color = c;
point = 1000000;
}
public void setPoint(int p)
{
point = p;
}
public double getPoint()
{
return point;
}
public void setMileage(int m)
{
Mileage = m;
}
public int getMileage()
{
return Mileage;
}
public void setWheels(int w)
{
NumbofWheels = w;
}
public int getWheels()
{
return NumbofWheels;
}
public void setColor(String c)
{
Color = c;
}
public String getColor()
{
return Color;
}
public void setOwner(String o)
{
owner = o;
}
public String getOwner()
{
return owner;
}
public void calPoint()
{
newPoint = point - Mileage * 0.5;
}
public double getnPoint()
{
return newPoint;
}
}
}
'
什麼下一步後?你沒有下一步。您只需閱讀按下的鍵並退出程序。 –
可能希望建議分開您的主程序類和實際的汽車類,因爲汽車通常不具有控制檯輸入和輸出。 – misha130