Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program Penitipan Hewan Peliharaan
- // Task file 066-P09.pptx
- // Amrul Mubarak Harahap
- // 19T03 - 1901098
- #include <string>
- #include <iostream>
- #include <iomanip>
- #include <cstring>
- using namespace std;
- struct {
- char jenis,kode,jnsh[10],jp[20];
- int jh,bp,st;
- } nama[5];
- int jh,tb,ub,uk,a;
- string petugas,pemilik;
- char ulang;
- void judul(){
- cout<<"\t\tPENITIPAN HEWAN PELIHARAAN"<<endl;
- cout<<"\t\t 'MEAOW PET CARE'"<<endl;
- }
- void garis(){
- int max,i;
- string pilih="=";
- max=53;
- for(i = 1; i <= max; i++){cout<<pilih;}
- cout<<endl;
- }
- void total_bayar(){
- tb=tb+nama[a].st;
- }
- int main(){
- menu:
- system("cls");
- judul();
- garis();
- cout<<"Nama Petugas : ";getline(cin, petugas);
- cout<<"Nama Pemilik : ";getline(cin, pemilik);
- cout<<"Jumlah Hewan : ";cin>>jh;
- cout<<endl;
- for(a=1;a<=jh;a++){
- cout<<"Hewan ke-"<<a<<endl;
- cout<<"Kode Jenis Hewan [K/H]: ";cin>>nama[a].jenis;
- cout<<"Kode Perawatan [1/2]: ";cin>>nama[a].kode;
- cout<<"Jumlah Hewan : ";cin>>nama[a].jh;
- cout<<endl;
- if(nama[a].jenis=='K'||nama[a].jenis=='k')
- {
- strcpy(nama[a].jnsh,"Kucing");
- if(nama[a].kode=='1')
- {
- strcpy(nama[a].jp,"Lux");
- nama[a].bp=250000;
- }
- else
- {
- strcpy(nama[a].jp,"Intensif");
- nama[a].bp=300000;
- }
- }
- else if(nama[a].jenis=='H'||nama[a].jenis=='h'){
- strcpy(nama[a].jnsh,"Hamster");
- if(nama[a].kode=='1'){
- strcpy(nama[a].jp,"Lux");
- nama[a].bp=150000;
- }
- else {
- strcpy(nama[a].jp,"Intensif");
- nama[a].bp=100000;
- }
- }
- else {
- cout<<"Maaf Kode Jenis Hewan Salah";
- }
- }
- system("cls");
- cout<<endl;
- judul();
- garis();
- cout<<"Nama Petugas : "<<petugas<<endl;
- cout<<"Nama Pemilik : "<<pemilik<<endl;
- garis();
- cout<<"No. Jenis Jenis Biaya Jumlah Subtotal"<<endl;
- cout<<" Hewan Perawatan Perawatan Hewan"<<endl;
- garis();
- for(a=1;a<=jh;a++){
- nama[a].st=nama[a].bp*nama[a].jh;
- cout<<" "<<a<<" "<<nama[a].jnsh<<" "<<nama[a].jp;
- cout<<" "<<nama[a].bp<<" "<<nama[a].jh<<" "<<nama[a].st<<endl;
- total_bayar();
- }
- garis();
- cout<<"\t\t\tTotal Bayar :Rp. "<<tb<<endl;
- cout<<"\t\t\tUang Bayar :Rp. ";cin>>ub;
- uk=ub-tb;
- cout<<"\t\t\tUang Kembali :Rp. "<<uk<<endl;
- garis();
- cout << "\n\t\t\t\tINGIN MENGULANG?(Y/T): "; cin >> ulang;
- if(ulang == 'Y' || ulang == 'y'){
- goto menu;
- } else {
- goto akhir;
- }
- akhir:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement