#include
<stdio.h>
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
judul()
{
puts(" PENITIPAN HEWAN PELIHARAAN");
puts("\t MEAOW PET CARE");
puts("=********************************=");
}
garis()
{
puts("===============================================================");
}
long ttlbay(long biaya, long jmltip)
{
return(biaya*jmltip);
}
long kembali(long uby, long ttlbay)
{
return(uby-ttlbay);
}
main()
{
int i, j;
long subtotal, u_bayar, u_kembali;
char lagi, nm_petugas[15], nm_pemilik[15];
struct
{
char jns_hewan[8], kd_hewan, jns_perawatan[8];
int kd_perawatan, jml_titip, biaya;
long tohar;
}hwn[100];
awal:
subtotal=0;
clrscr();
judul();
cout<<endl;
cout<<"Nama Petugas : "; cin>>nm_petugas;
cout<<"\nNama Pemilik : "; cin>>nm_pemilik;
cout<<"\nJumlah data peliharaan : "; cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<"Data ke - "<<i<<endl;
cout<<"Kode Jenis Hewan [K/H] : "; cin>>hwn[i].kd_hewan; cout<<endl;
cout<<"Kode perawatan [1/2] : "; cin>>hwn[i].kd_perawatan; cout<<endl;
if(hwn[i].kd_hewan=='K'||hwn[i].kd_hewan=='k')
{
strcpy(hwn[i].jns_hewan, "Kucing");
if(hwn[i].kd_perawatan==1)
{
strcpy(hwn[i].jns_perawatan, "LUX");
hwn[i].biaya=250000;
}
else if(hwn[i].kd_perawatan==2)
{
strcpy(hwn[i].jns_perawatan, "INTENSIF");
hwn[i].biaya=300000;
}
else
{
strcpy(hwn[i].jns_perawatan, "KODE SALAH");
hwn[i].biaya=0;
}
}
else if(hwn[i].kd_hewan=='H'||hwn[i].kd_hewan=='h')
{
strcpy(hwn[i].jns_hewan, "Hamster");
if(hwn[i].kd_perawatan==1)
{
strcpy(hwn[i].jns_perawatan, "LUX");
hwn[i].biaya=150000;
}
else if(hwn[i].kd_perawatan==2)
{
strcpy(hwn[i].jns_perawatan, "INTENSIF");
hwn[i].biaya=100000;
}
else
{
strcpy(hwn[i].jns_perawatan, "KODE SALAH");
hwn[i].biaya=0;
}
}
else
{
strcpy(hwn[i].jns_hewan, "KODE SALAH");
}
cout<<"Jumlah hewan : "; cin>>hwn[i].jml_titip;
cout<<endl;
hwn[i].tohar=ttlbay(hwn[i].biaya, hwn[i].jml_titip);
}
clrscr();
judul();
cout<<endl;
cout<<"Nama Petugas : "<<nm_petugas;
cout<<"\nNama Pemilik : "<<nm_pemilik;
cout<<endl<<endl;
garis();
puts("NO Jenis Jenis Biaya Jumlah Total");
puts(" Hewan Perawatan Perawatan Hewan");
garis();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(10)<<hwn[i].jns_hewan;
cout<<setiosflags(ios::left)<<setw(15)<<hwn[i].jns_perawatan;
cout<<setiosflags(ios::left)<<setw(11)<<hwn[i].biaya;
cout<<setiosflags(ios::left)<<setw(12)<<hwn[i].jml_titip;
cout<<setiosflags(ios::left)<<setw(4)<<hwn[i].tohar<<endl;
subtotal=subtotal+hwn[i].tohar;
}
garis();
cout<<" Total Bayar : "<<subtotal<<endl;
cout<<" Uang Bayar : "; cin>>u_bayar;
u_kembali=kembali(u_bayar, subtotal);
cout<<" Uang Kembali : "<<u_kembali;
cout<<endl<<endl;
cout<<"\t\t\tInput Data Lagi [Y/T]: ";cin>>lagi;
if(lagi=='y'||lagi=='Y')
goto awal;
else
goto akhir;
getch();
akhir:
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
judul()
{
puts(" PENITIPAN HEWAN PELIHARAAN");
puts("\t MEAOW PET CARE");
puts("=********************************=");
}
garis()
{
puts("===============================================================");
}
long ttlbay(long biaya, long jmltip)
{
return(biaya*jmltip);
}
long kembali(long uby, long ttlbay)
{
return(uby-ttlbay);
}
main()
{
int i, j;
long subtotal, u_bayar, u_kembali;
char lagi, nm_petugas[15], nm_pemilik[15];
struct
{
char jns_hewan[8], kd_hewan, jns_perawatan[8];
int kd_perawatan, jml_titip, biaya;
long tohar;
}hwn[100];
awal:
subtotal=0;
clrscr();
judul();
cout<<endl;
cout<<"Nama Petugas : "; cin>>nm_petugas;
cout<<"\nNama Pemilik : "; cin>>nm_pemilik;
cout<<"\nJumlah data peliharaan : "; cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<"Data ke - "<<i<<endl;
cout<<"Kode Jenis Hewan [K/H] : "; cin>>hwn[i].kd_hewan; cout<<endl;
cout<<"Kode perawatan [1/2] : "; cin>>hwn[i].kd_perawatan; cout<<endl;
if(hwn[i].kd_hewan=='K'||hwn[i].kd_hewan=='k')
{
strcpy(hwn[i].jns_hewan, "Kucing");
if(hwn[i].kd_perawatan==1)
{
strcpy(hwn[i].jns_perawatan, "LUX");
hwn[i].biaya=250000;
}
else if(hwn[i].kd_perawatan==2)
{
strcpy(hwn[i].jns_perawatan, "INTENSIF");
hwn[i].biaya=300000;
}
else
{
strcpy(hwn[i].jns_perawatan, "KODE SALAH");
hwn[i].biaya=0;
}
}
else if(hwn[i].kd_hewan=='H'||hwn[i].kd_hewan=='h')
{
strcpy(hwn[i].jns_hewan, "Hamster");
if(hwn[i].kd_perawatan==1)
{
strcpy(hwn[i].jns_perawatan, "LUX");
hwn[i].biaya=150000;
}
else if(hwn[i].kd_perawatan==2)
{
strcpy(hwn[i].jns_perawatan, "INTENSIF");
hwn[i].biaya=100000;
}
else
{
strcpy(hwn[i].jns_perawatan, "KODE SALAH");
hwn[i].biaya=0;
}
}
else
{
strcpy(hwn[i].jns_hewan, "KODE SALAH");
}
cout<<"Jumlah hewan : "; cin>>hwn[i].jml_titip;
cout<<endl;
hwn[i].tohar=ttlbay(hwn[i].biaya, hwn[i].jml_titip);
}
clrscr();
judul();
cout<<endl;
cout<<"Nama Petugas : "<<nm_petugas;
cout<<"\nNama Pemilik : "<<nm_pemilik;
cout<<endl<<endl;
garis();
puts("NO Jenis Jenis Biaya Jumlah Total");
puts(" Hewan Perawatan Perawatan Hewan");
garis();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(10)<<hwn[i].jns_hewan;
cout<<setiosflags(ios::left)<<setw(15)<<hwn[i].jns_perawatan;
cout<<setiosflags(ios::left)<<setw(11)<<hwn[i].biaya;
cout<<setiosflags(ios::left)<<setw(12)<<hwn[i].jml_titip;
cout<<setiosflags(ios::left)<<setw(4)<<hwn[i].tohar<<endl;
subtotal=subtotal+hwn[i].tohar;
}
garis();
cout<<" Total Bayar : "<<subtotal<<endl;
cout<<" Uang Bayar : "; cin>>u_bayar;
u_kembali=kembali(u_bayar, subtotal);
cout<<" Uang Kembali : "<<u_kembali;
cout<<endl<<endl;
cout<<"\t\t\tInput Data Lagi [Y/T]: ";cin>>lagi;
if(lagi=='y'||lagi=='Y')
goto awal;
else
goto akhir;
getch();
akhir:
}
Tidak ada komentar:
Posting Komentar