我想要做的是制作一个银行应用程序,一开始它会询问您是要创建储蓄账户还是活期账户,然后要求您输入所选账户的名称。我试图让程序用我写下的名字创建一个对象。它不认识我给他们起的名字。
class Program
{
static void Main()
{
Console.WriteLine("Enter 's' if you want a savings account. Enter
'c' if you want current account.");
string which = Console.ReadLine();
if (which == "s")
{
Console.WriteLine("Enter Name");
string name = Console.ReadLine();
Savingacc name;
name = new Savingacc();
name.mainmenu();
}
else if (which == "c")
{
Console.WriteLine("Enter Name");
string name = Console.ReadLine();
Currentacc name;
name = new Currentacc();
name.mainmenu();
}
}
}
相关分类