-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBank_Account_Mangement.cs
95 lines (80 loc) · 2.66 KB
/
Bank_Account_Mangement.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication283
{
class BankAccount
{
private int accnum;
private float accbal;
static float annualinterest = 0.03f;
public void enterAccountData(out int an,out float bal)
{
an = 0; bal = 0;
for (; ; )
{
Console.WriteLine("Enter account number");
int acno = int.Parse(Console.ReadLine());
if (acno < 0 || acno < 1000)
{
continue;
}
else
{
accnum = acno;
break;
}
}
for (; ; )
{
Console.WriteLine("Enter account Balance");
int tbal = int.Parse(Console.ReadLine());
if (tbal < 0)
{
continue;
}
else
{
accbal = tbal;
break;
}
}
}
public void computeInterest(int y)
{
Console.WriteLine(" Annual interest report\n");
float endbal=accbal;
for (int i = 1; i <= y; i++)
{
float interst = endbal * annualinterest * i;
float hold = accbal + interst;
endbal = hold;
Console.WriteLine("Ending balance in year "+i+" Rs : " + hold);
}
}
public void show()
{
Console.WriteLine(" Bank limited ");
Console.WriteLine(" Account number : "+accnum);
Console.WriteLine(" Opening balance : "+accbal);
Console.WriteLine(" =========================================");
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("enter account number not less then 1000 and negative balance not allow interest rate is 3 % annual fix");
int accno;
float balacc;
BankAccount obj = new BankAccount();
obj.enterAccountData(out accno,out balacc);
Console.WriteLine("enter years");
int year = int.Parse(Console.ReadLine());
obj.show();
obj.computeInterest(year);
}
}
}