Moha
Bank program help
using System;
class Bank
{
static void Main()
{
Console.WriteLine("Welcome to the bank. Please select one of the given options.");
Console.WriteLine("1. Withdraw money");
Console.WriteLine("2. Deposit money");
Console.WriteLine("3. Check balance");
Console.WriteLine("4. Send money");
int balance = 0;
int option = int.Parse(Console.ReadLine());
while (option >= 5)
{
Console.WriteLine("Please choose a valid option.");
option = int.Parse(Console.ReadLine());
}
if (option == 1)
{
Console.WriteLine("Please write the amount of money you are gonna withdraw.");
int amount = int.Parse(Console.ReadLine());
Console.WriteLine("Withdrawing " + amount + "...");
balance -= amount;
Console.WriteLine("Your new balance is " + balance + ".");
}
if (option == 2)
{
Console.WriteLine("Please write the amount of money you are gonna deposit.");
int amount = int.Parse(Console.ReadLine());
Console.WriteLine("Depositing " + amount + "...");
balance += amount;
Console.WriteLine("Your new balance is " + balance + ".");
}
}
}
using System;
class Bank
{
static void Main()
{
Console.WriteLine("Welcome to the bank. Please select one of the given options.");
Console.WriteLine("1. Withdraw money");
Console.WriteLine("2. Deposit money");
Console.WriteLine("3. Check balance");
Console.WriteLine("4. Send money");
int balance = 0;
int option = int.Parse(Console.ReadLine());
while (option >= 5)
{
Console.WriteLine("Please choose a valid option.");
option = int.Parse(Console.ReadLine());
}
if (option == 1)
{
Console.WriteLine("Please write the amount of money you are gonna withdraw.");
int amount = int.Parse(Console.ReadLine());
Console.WriteLine("Withdrawing " + amount + "...");
balance -= amount;
Console.WriteLine("Your new balance is " + balance + ".");
}
if (option == 2)
{
Console.WriteLine("Please write the amount of money you are gonna deposit.");
int amount = int.Parse(Console.ReadLine());
Console.WriteLine("Depositing " + amount + "...");
balance += amount;
Console.WriteLine("Your new balance is " + balance + ".");
}
}
}
29 replies