public class HelloWorld
{
private static int[] balance ={0};
public static void Main(string[] args)
{
while (true)
{
Console.WriteLine();
Console.WriteLine("Bank Account Menu:\n1. Deposit\n2. Withdraw\n3. Check Balance\n4. Exit");
Console.Write("Choose an option (1-4): ");
int choice = Convert.ToInt32(Console.ReadLine());
switch (choice)
{
case 1:
Deposit();
break;
case 2:
Withdraw();
break;
case 3:
Console.WriteLine($"Your current balance is: ${balance[0]}");
break;
case 4:
return;
default:
Console.Write("Invalid option.");
break;
}
}
}
static void Deposit()
{
Console.Write("Enter the amount to deposit: ");
int dp = Convert.ToInt32(Console.ReadLine());
balance [0] = dp;
Console.WriteLine($"${dp} has been deposited to your account.");
}
static void Withdraw()
{
Console.Write("Enter the amount to withdraw: ");
int wt = Convert.ToInt32(Console.ReadLine());
balance [0] = wt;
Console.WriteLine($"${wt} has been withdrawn from your account.");
}
using System;
public class HelloWorld { private static int[] balance ={0};
}