-
Notifications
You must be signed in to change notification settings - Fork 1
/
Account.cs
54 lines (47 loc) · 1.13 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsharpDemo
{
class Account
{
// Instance variables
private int acno;
private string ahname;
private double balance;
private static int minbal = 5000;
// Constructor
public Account(int ano, string name, double bal = 0)
{
acno = ano;
ahname = name;
balance = bal;
}
public Account()
{
}
// Methods
public void Deposit(double amount)
{
if (amount > 0)
balance += amount;
else
Console.WriteLine("Invalid amount!");
}
public void Withdraw(double amount)
{
if (amount <= balance)
balance -= amount;
else
Console.WriteLine("Insufficient Balance!");
}
public void Print()
{
Console.WriteLine(acno);
Console.WriteLine(ahname);
Console.WriteLine(balance);
}
}
}