imagine an atm machine, menus include balance inquiry, deposit, withdrawals and exit. write a method or function for each menu. the initial balance is d
using System;
using System.Threading;
namespace Bank
{
internal class Program
{
public static void Main()
{
// imagine an atm machine, menus include balance inquiry, deposit, withdrawals and exit.
// write a method or function for each menu. the initial balance is d
while (true)
{
Console.WriteLine("\t\t\t\t\t\t\t Select an action");
Console.WriteLine("1 = Get Balance");
Console.WriteLine("2 = Your Deposit");
Console.WriteLine("3 = Withdrawals");
Console.WriteLine("4 = Exit");
Console.Write("Enter action number: ");
int action = int.Parse(Console.ReadLine());
int d = 5000;
switch (action)
{
case 1: Console.WriteLine("Your Balance: " + Get_Balance(d)); break;
case 2: Console.Write("Your Deposit: " + Deposit(d)); break;
case 3: Withdrawals(d); break;
case 4: return;
default: Console.Write("Please select an action:"); Thread.Sleep(3200); Console.Clear(); Main(); break;
}
Console.ReadLine();
Console.Clear();
}
}
static int Get_Balance(int balance)
{
return balance;
}
static int Deposit(int d)
{
return d;
}
static void Withdrawals(int money)
{
Console.Write("How much money do you want to withdraw: ");
int get = int.Parse(Console.ReadLine());
Console.WriteLine($"Your Balance {money-get}");
}
}
}
Comments
Leave a comment