-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
58 lines (53 loc) · 1.85 KB
/
Program.cs
File metadata and controls
58 lines (53 loc) · 1.85 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
namespace PracticalTwo
{
internal static class Program
{
static void Main(string[] args)
{
CustomerAccount account = new(1231231231, "Bhavin");
account.BankName = "Bank Of Baroda";
account.PrintInfo();
Console.ReadLine();
}
}
internal class CustomerAccount
{
public string BankName = default!;
private readonly long _customerAccountNo;
private readonly String _customerName;
internal CustomerAccount(long accountNo, String customerName)
{
_customerName = customerName;
_customerAccountNo = accountNo;
}
/// <summary>
/// Prints customer account information
/// </summary>
internal void PrintInfo()
{
Console.WriteLine("\n==============BANK DETAIL==============");
Console.WriteLine($"Bank name: {BankName}");
Console.WriteLine($"Account holder name: {_customerName}");
Console.WriteLine($"Account number: {_customerAccountNo}");
Console.WriteLine("==============BANK DETAIL==============\n");
}
/// <summary>
/// Prints customer information & hide sensitive information
/// </summary>
internal void PrintMaskedInfo()
{
Console.WriteLine("\n==============BANK DETAIL==============");
Console.WriteLine($"Bank name: {BankName}");
Console.WriteLine($"Account holder name: {_customerName}");
Console.WriteLine($"Account number: {GetAccountNumber}");
Console.WriteLine("==============BANK DETAIL==============\n");
}
public string GetAccountNumber
{
get
{
return "***-***-" + _customerAccountNo.ToString().Substring(6, 4);
}
}
}
}