class BankAccountSimulator
{
static int balance = 0; //original balance
static void Main() //for the choices (1st static void)
{
while (true) //loop part
{
Choices();
int choice = Convert.ToInt32(Console.ReadLine());
if (choice == 1) {
Deposit(); }
else if (choice == 2) {
Withdraw(); }
else if (choice == 3) {
CheckBalance(); }
else if (choice == 4) {
Console.WriteLine("Thank you for using our service.");
break; } // for exiting the loop
else {
Console.WriteLine("Invalid option. Please try again."); } //if the user did not choose
Console.WriteLine();
}
}
static void Choices() //2nd static void
{
Console.WriteLine("Bank Account Menu:");
Console.WriteLine("1. Deposit");
Console.WriteLine("2. Withdraw");
Console.WriteLine("3. Check Balance");
Console.WriteLine("4. Exit");
Console.Write("Choose an option (1-4): ");
}
static void Deposit() //3rd static void
{
Console.Write("Enter the amount to deposit: ");
int amount = Convert.ToInt32(Console.ReadLine());
balance += amount;
Console.WriteLine($"${amount} has been deposited to your account.");
}
static void Withdraw() //4th static void
{
Console.Write("Enter the amount to withdraw: ");
int amount = Convert.ToInt32(Console.ReadLine());
if (amount > balance)
{
Console.WriteLine("Insufficient funds.");
}
else
{
balance -= amount;
Console.WriteLine($"${amount} has been withdrawn from your account.");
}
}
static void CheckBalance() //5th static void
{
Console.WriteLine($"Your current balance is: ${balance}");
}
//Chua, Louisse A. using System;
class BankAccountSimulator { static int balance = 0; //original balance static void Main() //for the choices (1st static void) { while (true) //loop part { Choices(); int choice = Convert.ToInt32(Console.ReadLine());
}