Anda di halaman 1dari 4

Nama : Maya Dzatir Rosidah Yisri Atmadja

Kelas : B
NIM : 5180711100

PROGRAM BANK ABC


1. Kode Program
#include<iostream>
using namespace::std;
void identitas()
{
struct data{char nama[50];string nik,umur;};
data d;
cout<<"Nama Lengkap : ";
cin.getline(d.nama,50);
cout<<"No. KTP : ";
cin>>d.nik;
cout<<"Umur Anda : ";
cin>>d.umur;
return;
}
void garis()
{
cout<<"--------------------------------------------"<<endl;
return;
}
void pelajar()
{
float bl,s,t;
double tot,pot,bg,pots=0,bgs=0;
string in;
cout<<"Saldo awal (min. Rp 50.000) : Rp. ";
cin>>s;
cout<<"Berapa bulan menabung?";
cin>>bl;
for(int n=1;n<=bl;n++)
{
cout<<"Tabungan bulan ke-"<<n;
cout<<" = Rp. ";
cin>>t;
pot=t-10000;
cout<<"Setelah dipotong = Rp. "<<pot<<endl;
bg=0.05*t;
cout<<"Bunga 5% = Rp. "<<bg<<endl;
pots=pots+pot;
bgs=bgs+bg;
}
tot=pots+bgs;
cout<<"Total saldo akhir = "<<tot<<endl;
}
void mahasiswa()
{
int x=0;
float bl,s,t;
long double tot,pot,bg,tbg,pots=0,bgs=0,tbgs=0;
string in;
cout<<"Saldo awal (min. Rp 100.000) : Rp. ";
cin>>s;
cout<<"Berapa bulan menabung?";
cin>>bl;
for(int n=1;n<=bl;n++)
{

cout<<"Tabungan bulan ke-"<<n;


cout<<" = Rp. ";
cin>>t;
pot=t-10000;
cout<<"Setelah dipotong = Rp. "<<pot<<endl;
bg=0.05*t;
cout<<"Bunga 5% = Rp. "<<bg<<endl;
do{
n++;
if(bl%3=0)
{
tbg=0,03*t;
cout<<"Tambahan bunga 3% = Rp. "<<tbg<<endl;
}
pots=pots+pot;
bgs=bgs+bg;
tbgs=tbgs+tbg;
}while(n<=bl);
}
tot=pots+bgs+tbgs;
cout<<"Total saldo akhir = "<<tot<<endl;
}
void karyawan()
{
int x=0;
float bl,s,t;
long double tot,pot,bg,tbg,pots=0,bgs=0,tbgs=0;
string in;
cout<<"Saldo awal (min. Rp 100.000) : Rp. ";
cin>>s;
cout<<"Berapa bulan menabung?";
cin>>bl;
for(int n=1;n<=bl;n++)
{

cout<<"Tabungan bulan ke-"<<n;


cout<<" = Rp. ";
cin>>t;
pot=t-10000;
cout<<"Setelah dipotong = Rp. "<<pot<<endl;
bg=0.05*t;
cout<<"Bunga 5% = Rp. "<<bg<<endl;
do{
n++;
if(bl%3=0)
{
tbg=0,03*t;
cout<<"Tambahan bunga 3% = Rp. "<<tbg<<endl;
}
pots=pots+pot;
bgs=bgs+bg;
tbgs=tbgs+tbg;
}while(n<=bl);
}
tot=pots+bgs+tbgs;
cout<<"Total saldo akhir = "<<tot<<endl;
}
main()
{
int pil;
cout<<"SELAMAT DATANG DI PROGRAM NASABAH BANK ABC"<<endl;
garis();
identitas();
garis();
cout<<"Pilihan kategori nasabah"<<endl;
cout<<"1. Pelajar (min. 17 thn)"<<endl;
cout<<"2. Mahasiswa"<<endl;
cout<<"3. Karyawan"<<endl;
cout<<"Masukkan pilihan Anda (1/2/3)";
cin>>pil;
if(pil==1)
{
pelajar();
garis();
}
else if(pil==2)
{
mahasiswa();
garis();
}
else
{
karyawan();
garis();
}
garis();

}
2. Deskripsi
Terdapat 6 prosedur fungsi yang digunakan yaitu:
- Void data yang berisi struct data, lalu untuk variabel nama menggunakan cin.getline dan
array agar bisa input menggunakan spasi, lalu ada variabel lain yaitu umur dan nik.
- Void garis yang berisi output garis
- Void pelajar yang berisi input saldo, tabungan berapa bulan lalu menggunakan
perulangan for sesuai dengan bulan yang diinput, misal 3 bulan maka output di dalam for
yaitu jumlah tabungan, potongan 10.000 dan bunga 5% akan mengulang sampai 3, lalu
ada total saldo akhir
- Void mahasiswa dan karyawan yang berisi sama seperti void pelajar tetapi ada tambahan
bunga 3% setiap program pada kelipatan 3 bulan.
- Main yang berisi void data, void garis, void pelajar, void mahasiswa dan void karyawan
karena akan ditampilkan di prosedur ini.
3. Hasil Run
CUMLAUDE

Anda mungkin juga menyukai