-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (33 loc) · 1.18 KB
/
Program.cs
File metadata and controls
41 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MySuperBank
{
class Program
{
static void Main(string[] args)
{
var account = new BankAccount("Rohit", 10000);
Console.WriteLine($"Account {account.Number}I was created for {account.Owner} with {account.Balance} balance");
account.MakeWithdrawal(120, DateTime.Now, "Rohan");
Console.WriteLine(account.Balance);
// account.MakeDeposite(-100, DateTime.Now, "Staeling");
//Test that the initial balances must be positive
try
{
var invalidAccount = new BankAccount("Invalid", 3355);
}
catch (ArgumentOutOfRangeException e)
{
Console.WriteLine("Exception caught creating account with negative balance");
Console.WriteLine(e.ToString());
}
account.MakeWithdrawal(50, DateTime.Now, "Sid");
Console.WriteLine(account.Balance);
Console.WriteLine(account.GetAcountHistory());
Console.ReadLine();
}
}
}