project pembuatan aplikasi
PERTEMUAN 14: PROJECT PEMBUATAN APLIKASI
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
using namespace std;
judul()
{
printf(" Pet Klinic\n");
printf("KODE Layanan V = PET VACANATION | T =
THREATMENT M = MEDICATION\n");
printf(" 1 = PAGI | 2 = SIANG\n");
printf("
*******************************\n");
}
garis()
{
printf("======================================================================\n");
}
struct
{
char ko[2],wt[20],paket[20],waktu_tayang[20];
int banyak;
long harga,subtotal;
}ra[10];
char penyewa[10],petugas[10],lagi,menu;
int a,b;
long total,bayar,kembali;
float ppn;
sum()
{
total=total+ra[a].subtotal;
}
int main()
{
awal:
system("cls");
total=0;
judul();
cout<<""<<endl;
cout<<"Selamat Datang Di Klnik \"Pet
Clinic\".."<<endl<<endl;
cout<<"Pilihan Menu : "<<endl;
cout<<" 1. Input Data
Transaksi"<<endl;
cout<<" 2. Log
Out"<<endl<<endl;
garis();
cout<<"Inputkan Pilihan Anda =
";menu=getch();
cout<<menu<<endl;
cout<<"Tekan ENTER untuk
melanjutkan..";getch();
if(menu=='1') goto transaksi;
else if(menu=='2') goto akhir;
transaksi:
system("cls");
judul();
cout<<endl;
cout<<"INPUT DATA
TRANSAKSI"<<endl<<endl;;
cout<<"Nama Petugas :
";cin>>petugas;
cout<<"Nama Pemilik :
";cin>>penyewa;
cout<<"Banyak Data : ";cin>>b;
cout<<endl<<endl;
for(a=1;a<=b;a++)
{
cout<<"Data ke -
"<<a<<endl;
cout<<"Input Kode PET CLINIC [V/T/M] : ";cin>>ra[a].ko;
cout<<"Input Kode Layanan 1|2 :
";cin>>ra[a].wt;
cout<<"Jumlah Beli : ";cin>>ra[a].banyak;
cout<<endl;
if((!strcmp(ra[a].ko,"v"))||(!strcmp(ra[a].ko,"V")))
{
strcpy(ra[a].paket,"PET VACCANATION");
if((!strcmp(ra[a].wt,"1")))
{
strcpy(ra[a].waktu_tayang,"Pagi");
ra[a].harga=120000;
}
else
if((!strcmp(ra[a].wt,"2")))
{
strcpy(ra[a].waktu_tayang,"Siang");
ra[a].harga=150000;
}
}
if((!strcmp(ra[a].ko,"t"))||(!strcmp(ra[a].ko,"T")))
{
strcpy(ra[a].paket,"THREATMENT");
if((!strcmp(ra[a].wt,"1")))
{
strcpy(ra[a].waktu_tayang,"Pagi");
ra[a].harga=80000;
}
else if((!strcmp(ra[a].wt,"2")))
{
strcpy(ra[a].waktu_tayang,"Siang");
ra[a].harga=120000;
}
}
else
if((!strcmp(ra[a].ko,"m"))||(!strcmp(ra[a].ko,"M")))
{
strcpy(ra[a].paket,"MEDICATION");
if((!strcmp(ra[a].wt,"1")))
{
strcpy(ra[a].waktu_tayang,"Pagi");
ra[a].harga=60000;
}
else
if((!strcmp(ra[a].wt,"2")))
{
strcpy(ra[a].waktu_tayang,"Siang");
ra[a].harga=80000;
}
}
}
system("cls");
judul();
cout<<"Nama Petugas : "<<petugas<<endl;
cout<<"Nama Pemilik :
"<<penyewa<<endl<<endl;
cout<<"DATA PELAYANAN"<<endl;
garis();
cout<<"No. Nama Waktu Harga Jumlah Subtotal"<<endl;
cout<<" Layanan Kunjungan Beli "<<endl;
garis();
for(a=1;a<=b;a++)
{
cout<<setiosflags(ios::left)<<setw(5)<<a;
cout<<setiosflags(ios::left)<<setw(17)<<ra[a].paket;
cout<<setiosflags(ios::left)<<setw(17)<<ra[a].waktu_tayang;
cout<<setiosflags(ios::left)<<setw(12)<<ra[a].harga;
cout<<setiosflags(ios::left)<<setw(11)<<ra[a].banyak;
if(ra[a].banyak >=3)
{
ppn=ra[a].harga*0.1;
}
else if(ra[a].banyak <3)
{
ppn=0;
}
ra[a].subtotal=ra[a].harga*ra[a].banyak;
cout<<setiosflags(ios::left)<<setw(11)<<ra[a].subtotal<<endl;
sum();
}
cout<<endl;
garis();
cout<<endl;
cout<<" PPN : "<<ppn<<endl;
cout<<" Total Bayar : "<<total<<endl;
cout<<" Uang Bayar : ";cin>>bayar;
kembali=bayar-total;
cout<<" Uang Kembali : "<<kembali;
cout<<endl<<endl;
garis();
cout<<"Terimakasih Atas Kepercayaan Anda
Kepada Pet clinic Kami.."<<endl<<endl;
cout<<"Input Data Lagi [Y/T]
???";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
else
goto akhir;
akhir:
getch();
}
|
Hasil Outputnya:
Komentar
Posting Komentar