-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccount.cs
77 lines (72 loc) · 2.1 KB
/
Account.cs
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Text;
namespace MidAssignment1
{
class Account
{
private int accountNumber;
private string accountName;
private double balance;
private Address address;
public Account(int accountNumber, string accountName, double balance, Address address)
{
this.accountNumber = accountNumber;
this.accountName = accountName;
this.balance = balance;
this.address = address;
}
public int AccountNumber
{
set { this.accountNumber = value; }
get { return this.accountNumber; }
}
public string AccountName
{
set { this.accountName = value; }
get { return this.accountName; }
}
public double Balance
{
set { this.balance = value; }
get { return this.balance; }
}
public Address Address
{
set { this.address = value; }
get { return this.address; }
}
public void Widraw(double ammount)
{
if (balance < ammount)
{
Console.WriteLine("NOT ENOUGH BALANCE");
}
else
{
balance -= ammount;
}
}
public void Diposit(double ammount)
{
balance += ammount;
}
public void Transfer(Account receiver, double ammount)
{
if (balance < ammount)
{
Console.WriteLine("NOT ENOUGH BALANCE");
}
else
{
this.balance -= ammount;
receiver.Balance += ammount;
}
}
public void ShowAccountInfo()
{
Console.WriteLine("ACCOUNT INFORMATION\n" + "Account Number: " + this.accountNumber +
"\nName: " + this.accountName + "\nBalance: " + this.balance + "\nAddress: " + address.getAddress());
}
}
}