#include<iostream>
#include<iomanip>
using namespace std;
class tabungan
{
double saldo;
int norek;
char nama[21];
public :
tabungan();
void getnama(char *);
double getsaldo();
int getnorek();
void buat_akun();
void setoran();
void penarikan();
void transfer();
void cek_saldo();
void cetak();
}; //akhir class
tabungan nasabah[7];
int jum_akun;
tabungan::tabungan()
{
saldo=0;
norek=0;
strcpy(nama,"NULL");
}
void tabungan::getnama(char *s)
{
strcpy(s,nama);
}
double tabungan::getsaldo()
{
return (saldo);
}
int tabungan::getnorek()
{
return (norek);
}
void tabungan::buat_akun()
{
do
{
cout<<"masukkan jumlah akun yang ingin anda buat [1-5]: ";
cin>>jum_akun;
cin.clear();
cin.sync();
}while(jum_akun<1 || jum_akun>5);
for(int i=1;i<jum_akun;i++)
{
cout<<"masukkan nama akun"<<i<<" : ";
cin>>nasabah[i].nama;
cin.clear();
cin.sync();
nasabah[i].norek=i;
cout<<"nomer rekening akun"<<i<<" : "<<nasabah[i].norek<<endl;
cout<<"masukkan saldo awal akun "<<i<<" : ";
cin>>nasabah[i].saldo;
cin.clear();
cin.sync();
cout<<"pembuatan akun "<<i<<" sukses!";
}
cout<<jum_akun<<" akun telah selesai di buat!"<<endl;
}
void tabungan::setoran()
{
int temp;
double temp2;
cout<<"masukkan nomer rekening : ";
cin>>temp;
cin.clear();
cin.sync();
nasabah[temp].norek=temp;
cout<<nasabah[temp].nama<<" saldo : "<<nasabah[temp].saldo<<endl;
cout<<"jumlah uang yang ingin di setor : ";
cin>>temp2;
cin.clear();
cin.sync();
nasabah[temp].saldo+=saldo;
cout<<"proses sukses!"<<endl
<<"saldo "<<nasabah[temp].nama<<" sekarang : "<<nasabah[temp].saldo<<endl<<endl<<endl;
}
void tabungan::penarikan()
{
int i;
double j;
cout<<"masukkan nomer rekening : ";
cin>>i;
cin.clear();
cin.sync();
nasabah[i].norek=i;
cout<<nasabah[i].nama<<" saldo : "<<nasabah[i].saldo<<endl;
cout<<"jumlah uang yang ingin di ambil : ";
cin>>j;
cin.clear();
cin.sync();
nasabah[i].saldo-=saldo;
cout<<"proses sukses!"<<endl
<<"saldo "<<nasabah[i].nama<<" sekarang : "<<nasabah[i].saldo<<endl<<endl<<endl;
}
void tabungan::transfer()
{
int a;
double b;
int c;
cout<<"masukkan nomer rekening : ";
cin>>a;
cin.clear();
cin.sync();
nasabah[a].norek=a;
cout<<nasabah[a].nama<<" saldo : "<<nasabah[a].saldo<<endl;
cout<<"jumlah uang yang ingin di transfer : ";
cin>>b;
cin.clear();
cin.sync();
cout<<"nomer rekening tujuan : ";
cin>>c;
cin.clear();
cin.sync();
nasabah[a].saldo-=saldo;
cout<<"proses sukses!"<<endl
<<"saldo "<<nasabah[a].nama<<" sekarang : "<<nasabah[a].saldo<<endl<<endl<<endl;
}
void tabungan::cek_saldo()
{
int z;
cout<<"masukkan nomer rekening : ";
cin>>z;
cin.clear();
cin.sync();
nasabah[z].norek=z;
cout<<"jumlah saldo "<<nasabah[z].nama<<" : "<<nasabah[z].saldo;
}
void tabungan::cetak()
{
cout << endl << endl;
cout << "|--------------------------|---------------------|----------------------|" << endl;
cout << "| Nomer Rekening | Nama Nasabah | Saldo |" << endl;
cout << "|--------------------------|---------------------|----------------------|"<< endl;
for(int i=1;i<jum_akun;i++)
{
cout.setf(ios::left|ios::showpoint);
cout << "| ";
cout.width(25);
cout << nasabah[i].norek;
cout << "|";
cout.width(21);
cout << nasabah[i].nama;
cout << "|";
cout.width(23);
cout << nasabah[i].saldo;
cout << "|\n";
}
}
void main()
{
tabungan temp;
int pilihan;
do
{
system("cls");
cout<<"----------------BANK PNT----------------"
<<endl
<<"========================================"
<<endl<<endl;
cout<<"1. Buat akun"<<endl
<<"2. Setoran"<<endl
<<"3. Penarikan"<<endl
<<"4. Transfer"<<endl
<<"5. Cek Saldo"<<endl
<<"6. Cetak Daftar Nasabah"<<endl
<<"7. Keluar"<<endl<<endl<<endl
<<"Masu kkan Pilihan Anda : ";
cin>>pilihan;
cin.clear();
cin.sync();
}while(pilihan!=7);
switch(pilihan)
{
case 1:
nasabah[1].buat_akun();
break;
case 2:
temp.setoran();
break;
case 3:
temp.penarikan();
break;
case 4:
temp.transfer();
break;
case 5:
temp.cek_saldo();
break;
case 6:
temp.cetak();
break;
case 7:
cout<<"tekan enter untuk keluar"<<endl<<endl<<endl;
break;
default:
cout<<"masukkan pilihan dengan benar!";
system("pause");
break;
}
system("pause");
}
//mohon bantuan ny
#include<iomanip>
using namespace std;
class tabungan
{
double saldo;
int norek;
char nama[21];
public :
tabungan();
void getnama(char *);
double getsaldo();
int getnorek();
void buat_akun();
void setoran();
void penarikan();
void transfer();
void cek_saldo();
void cetak();
}; //akhir class
tabungan nasabah[7];
int jum_akun;
tabungan::tabungan()
{
saldo=0;
norek=0;
strcpy(nama,"NULL");
}
void tabungan::getnama(char *s)
{
strcpy(s,nama);
}
double tabungan::getsaldo()
{
return (saldo);
}
int tabungan::getnorek()
{
return (norek);
}
void tabungan::buat_akun()
{
do
{
cout<<"masukkan jumlah akun yang ingin anda buat [1-5]: ";
cin>>jum_akun;
cin.clear();
cin.sync();
}while(jum_akun<1 || jum_akun>5);
for(int i=1;i<jum_akun;i++)
{
cout<<"masukkan nama akun"<<i<<" : ";
cin>>nasabah[i].nama;
cin.clear();
cin.sync();
nasabah[i].norek=i;
cout<<"nomer rekening akun"<<i<<" : "<<nasabah[i].norek<<endl;
cout<<"masukkan saldo awal akun "<<i<<" : ";
cin>>nasabah[i].saldo;
cin.clear();
cin.sync();
cout<<"pembuatan akun "<<i<<" sukses!";
}
cout<<jum_akun<<" akun telah selesai di buat!"<<endl;
}
void tabungan::setoran()
{
int temp;
double temp2;
cout<<"masukkan nomer rekening : ";
cin>>temp;
cin.clear();
cin.sync();
nasabah[temp].norek=temp;
cout<<nasabah[temp].nama<<" saldo : "<<nasabah[temp].saldo<<endl;
cout<<"jumlah uang yang ingin di setor : ";
cin>>temp2;
cin.clear();
cin.sync();
nasabah[temp].saldo+=saldo;
cout<<"proses sukses!"<<endl
<<"saldo "<<nasabah[temp].nama<<" sekarang : "<<nasabah[temp].saldo<<endl<<endl<<endl;
}
void tabungan::penarikan()
{
int i;
double j;
cout<<"masukkan nomer rekening : ";
cin>>i;
cin.clear();
cin.sync();
nasabah[i].norek=i;
cout<<nasabah[i].nama<<" saldo : "<<nasabah[i].saldo<<endl;
cout<<"jumlah uang yang ingin di ambil : ";
cin>>j;
cin.clear();
cin.sync();
nasabah[i].saldo-=saldo;
cout<<"proses sukses!"<<endl
<<"saldo "<<nasabah[i].nama<<" sekarang : "<<nasabah[i].saldo<<endl<<endl<<endl;
}
void tabungan::transfer()
{
int a;
double b;
int c;
cout<<"masukkan nomer rekening : ";
cin>>a;
cin.clear();
cin.sync();
nasabah[a].norek=a;
cout<<nasabah[a].nama<<" saldo : "<<nasabah[a].saldo<<endl;
cout<<"jumlah uang yang ingin di transfer : ";
cin>>b;
cin.clear();
cin.sync();
cout<<"nomer rekening tujuan : ";
cin>>c;
cin.clear();
cin.sync();
nasabah[a].saldo-=saldo;
cout<<"proses sukses!"<<endl
<<"saldo "<<nasabah[a].nama<<" sekarang : "<<nasabah[a].saldo<<endl<<endl<<endl;
}
void tabungan::cek_saldo()
{
int z;
cout<<"masukkan nomer rekening : ";
cin>>z;
cin.clear();
cin.sync();
nasabah[z].norek=z;
cout<<"jumlah saldo "<<nasabah[z].nama<<" : "<<nasabah[z].saldo;
}
void tabungan::cetak()
{
cout << endl << endl;
cout << "|--------------------------|---------------------|----------------------|" << endl;
cout << "| Nomer Rekening | Nama Nasabah | Saldo |" << endl;
cout << "|--------------------------|---------------------|----------------------|"<< endl;
for(int i=1;i<jum_akun;i++)
{
cout.setf(ios::left|ios::showpoint);
cout << "| ";
cout.width(25);
cout << nasabah[i].norek;
cout << "|";
cout.width(21);
cout << nasabah[i].nama;
cout << "|";
cout.width(23);
cout << nasabah[i].saldo;
cout << "|\n";
}
}
void main()
{
tabungan temp;
int pilihan;
do
{
system("cls");
cout<<"----------------BANK PNT----------------"
<<endl
<<"========================================"
<<endl<<endl;
cout<<"1. Buat akun"<<endl
<<"2. Setoran"<<endl
<<"3. Penarikan"<<endl
<<"4. Transfer"<<endl
<<"5. Cek Saldo"<<endl
<<"6. Cetak Daftar Nasabah"<<endl
<<"7. Keluar"<<endl<<endl<<endl
<<"Masu kkan Pilihan Anda : ";
cin>>pilihan;
cin.clear();
cin.sync();
}while(pilihan!=7);
switch(pilihan)
{
case 1:
nasabah[1].buat_akun();
break;
case 2:
temp.setoran();
break;
case 3:
temp.penarikan();
break;
case 4:
temp.transfer();
break;
case 5:
temp.cek_saldo();
break;
case 6:
temp.cetak();
break;
case 7:
cout<<"tekan enter untuk keluar"<<endl<<endl<<endl;
break;
default:
cout<<"masukkan pilihan dengan benar!";
system("pause");
break;
}
system("pause");
}
//mohon bantuan ny
Tidak ada komentar:
Posting Komentar