我刚刚开始学习 C#,所以很新……我正在尝试编写 Check balance 的方法,但不断收到我在标题中所说的错误……我知道代码还没有完成,但只是想能够暂时返回帐户类型菜单??
还有人能够解释“静态无效开始(参考布尔尺寸更新)”这一行我真的不知道这是做什么的。谢谢!!
class Program
{
static void start(ref bool dimensionsUpdated){
int userOption = 0;
//Repeats the loop until the user wishes to exit
do
{
Console.WriteLine("Welcome to EziTeller ATM Machine\n\n");
Console.WriteLine("Transaction Menu"
+ "\n================\n"
+ "\n1) Check Balance"
+ "\n2) Withdraw"
+ "\n3) Transfer");
Console.WriteLine("\n\nPlease Enter Your Option: 1, 2, 3 or 0 to exit: ");
//Read in the users choice
userOption = int.Parse(Console.ReadLine());
Console.ReadKey();
//Run a series of checks to see what the user chose.
//Open the desired method, otherwise show error message
//Asking the user to input a VALID option.
if (userOption == 0)
{
Console.WriteLine("Thank you for using EziTeller!");
Environment.Exit(0);
}
else if (userOption == 1){
checkBalance(ref dimensionsUpdated);
}
else if (userOption == 2){
withdrawMoney(ref dimensionsUpdated);
}
else if (userOption == 3){
transferMoney(ref dimensionsUpdated);
}
else Console.WriteLine("\n\nPlease enter a valid option, either 1, 2, 3, or 0 to exit\n\n");
} while (userOption != 0);
}
public static double checkBalance(ref bool dimensionsUpdated){
Console.WriteLine("Account Types"
+ "\n============\n"
+ "\n1) Savings Account"
+ "\n2) Debit Card"
+ "\n3) Credit Card"
+ "\n4) Line of Credit");
Console.WriteLine("\n\nPlease Enter Your Option: 1...4 or 0 to exit: ");