using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
abstract class bank
{
static int amount;
public void deposit()
{
int amt = int.Parse(Console.ReadLine());
amount += amt;
}
public void withdraw()
{
int amt = int.Parse(Console.ReadLine());
if (amount < amt)
{
Console.WriteLine("Saldo Kurang");
}
else
{
amount -= amt;
}
}
public void cek_saldo()
{
Console.WriteLine("Jumlah Saldo Anda = {0}", amount);
}
}
class BNI : bank
{
public void jumlah_rekening_dari_nasabah()
{
base.deposit();
base.withdraw();
base.cek_saldo();
}
}
class Program
{
static void Main(string[] args)
{
Console.Write("Jumlah Nasabah = ");
int n_nasabah = int.Parse(Console.ReadLine());
BNI[] nasabah = new BNI[n_nasabah + 1];
for (int i = 1; i <= n_nasabah; i++)
{
nasabah[i] = new BNI();
}
while (true)
{
Console.WriteLine("Pilihan : ");
Console.WriteLine(" 1. Menabung");
Console.WriteLine(" 2. Mengambil Uang");
Console.WriteLine(" 3. Cek_Saldo");
Console.WriteLine(" 4. keluar");
Console.Write("Pilih : ");
int pilih = int.Parse(Console.ReadLine());
int no_rek;
switch (pilih)
{
case 1:
{
Console.Write("Nomor Rekening Anda : ");
no_rek = int.Parse(Console.ReadLine());
Console.Write("Jumlah Uang ");
BNI obj = new BNI();
obj.deposit();
break;
}
case 2:
{
Console.Write("Nomor Rekening Anda : ");
no_rek = int.Parse(Console.ReadLine());
Console.Write("Jumlah Uang ");
BNI obj = new BNI();
obj.withdraw();
break;
}
case 3:
{
Console.Write("Nomor Rekening Anda : ");
no_rek = int.Parse(Console.ReadLine());
BNI obj = new BNI();
obj.cek_saldo();
break;
}
case 4:
{
return;
}
}
}
}
}
}
No comments:
Post a Comment