public decimal CurrentBalance = 1000.00m;
public decimal WithdrawCurrentAmount { get; set; }
public decimal MakeWithdraw()
{
Console.WriteLine("How much would you like to withdraw from your Current account?", WithdrawCurrentAmount);
if (WithdrawCurrentAmount < 0)
{
throw new Exception("You cannot withdraw a negative amount" );
}
WithdrawCurrentAmount = Convert.ToDecimal(Console.ReadLine());
CurrentBalance = CurrentBalance - WithdrawCurrentAmount;
Console.WriteLine("\nAvailable Current Balance is now: {0}", CurrentBalance);
return CurrentBalance;
}
mercredi 5 février 2020
The console is supposed to throw exception if I enter a negative number but it is not working. Am I missing something here?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire