Hai..
Kali ini saya akan berbagi mengenai tugas Algoritma & Pemrograman tentang tugas kelompok saya
disini saya akan memberi contoh tentang :
program showroom mobil & motor
langsung saja..
ini adalah screen shootnya
dan ini adalah source codenya menggunakan borland C++
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<dos.h>
#include<iomanip.h>
#include<windows.h>
judul()
{
cout<<" *BSI-KALIABANG SHOWROOM* " <<endl;
cout<<" Menjual kendaraan Mewah, Elegan & Berkelas" <<endl;
cout<<"------------------------------------------------------------------------"<<endl;
cout<<"Kode Kendaraan Jenis Kendaraan Kode Jenis Merk Harga($)"<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
cout<<" MBL Mobil 1 Lamborghini 10000000"<<endl;
cout<<" 2 Ferrari 8000000"<<endl;
cout<<" 3 Porsche 5000000"<<endl;
cout<<" MTR Motor 1 Harley 1000000"<<endl;
cout<<" 2 Ducati 800000"<<endl;
cout<<" 3 Tomahawk 500000"<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
}
subs()
{
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
cout<<"No. Kode Jenis Merk Harga Jumlah Subtotal "<<endl;
cout<<" Kendaraan Kendaraan ($) Kendaraan "<<endl;
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
}
total_bayar(long totalbayar,long subtotal)
{
return(totalbayar+subtotal);
}
main()
{
struct
{
char kk[10],kp,jk[10],m[15];
int jml;
long biaya,sub;
}
sr[10];
char ketik[]={" TUGAS KELOMPOK ALGORITMA & PEMROGRAMAN BSI-KALIABANG (SHOWROOM)\n"};
int ketik2;
double ketik3;
char nm_petugas[20],nm_pembeli[20],ulang;
int i,jdp;
long totbay =0,ubay,ukem,pajak,afpajak;
awal:
clrscr();
for(ketik2=0;ketik[ketik2]!='\0';ketik2++)
{
printf("%c",ketik[ketik2]);
for(ketik3=0;ketik3<=9999999;ketik3++){
}
}
clrscr();
system ("color 2");
cout<<" Algoritma & Pemrograman " <<endl;
sleep(1);
cout<<" 12.1A.05 " <<endl;
cout<<" Nama NIM " <<endl;
sleep(1);
cout<<" Adjie Krisnandy (12132469) " <<endl;
sleep(1);
cout<<" Umi Kulsum (12131767) " <<endl;
sleep(1);
cout<<" Arief Syafrizal (12131834) " <<endl;
sleep(1);
cout<<" Abdurrahman Al Ghazi (12131837) " <<endl;
sleep(1);
cout<<" Raydatul Fiqri (12137305) " <<endl;
sleep(1);
system("color 9");
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
judul();
sleep(1);
cout<<" Nama Petugas : " ;gets(nm_petugas);
cout<<" Nama Pembeli : " ;gets(nm_pembeli);
cout<<" Jumlah Data Pembelian : " ;cin>>jdp;
for(i=1;i<=jdp;i++)
{
cout<<" Pembelian Ke-"<<i<<endl;
cout<<" Kode Kendaraan [MBL/MTR]: " ;cin>>sr[i].kk;
cout<<" Kode Jenis [1/2/3] : " ;cin>>sr[i].kp;
cout<<" Jumlah Kendaraan : " ;cin>>sr[i].jml;
if(strcmp(sr[i].kk,"MBL")==0 ||strcmp(sr[i].kk, "mbl")==0)
{
strcpy(sr[i].jk,"Mobil");
if(sr[i].kp=='1')
{
strcpy(sr[i].m,"Lamborghini");
sr[i].biaya=10000000;
}
else if(sr[i].kp=='2')
{
strcpy(sr[i].m,"Ferrari");
sr[i].biaya=8000000;
}
else if(sr[i].kp=='3')
{
strcpy(sr[i].m,"Porsche");
sr[i].biaya=5000000;
}
}
if(strcmp(sr[i].kk,"MTR")==0 ||strcmp(sr[i].kk, "mtr")==0)
{
strcpy(sr[i].jk,"Motor");
if(sr[i].kp=='1')
{
strcpy(sr[i].m,"Harley");
sr[i].biaya=1000000;
}
else if(sr[i].kp=='2')
{
strcpy(sr[i].m,"Ducati");
sr[i].biaya=800000;
}
else if(sr[i].kp=='3')
{
strcpy(sr[i].m,"Tomahawk");
sr[i].biaya=500000;
}
}
sr[i].sub=sr[i].biaya*sr[i].jml;
totbay=total_bayar(sr[i].sub,totbay);
pajak=totbay*0.1;
afpajak=totbay+pajak;
}
cout<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
cout<<" Nama Petugas : "<<nm_petugas<<endl;
cout<<" Nama Pembeli : "<<nm_pembeli<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
subs();
for(i=1;i<=jdp;i++)
{
cout<<setiosflags(ios::left)<<setw(7)<<i;
cout<<setiosflags(ios::left)<<setw(10)<<sr[i].kk;
cout<<setiosflags(ios::left)<<setw(12)<<sr[i].jk;
cout<<setiosflags(ios::left)<<setw(13)<<sr[i].m;
cout<<setiosflags(ios::left)<<setw(14)<<sr[i].biaya;
cout<<setiosflags(ios::left)<<setw(8)<<sr[i].jml;
cout<<setiosflags(ios::left)<<setw(8)<<sr[i].sub<<endl<<endl;
}
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
cout<<" Total : "<<totbay<<endl;
cout<<" Pajak : "<<pajak<<endl;
cout<<" Total Bayar : "<<afpajak<<endl;
cout<<" Uang Bayar : ";cin>>ubay;
ukem = ubay - afpajak;
cout<<" Uang Kembali : "<<ukem<<endl;
cout<<" INGIN INPUT LAGI [Y/N] : "; cin>>ulang;
if(ulang=='Y' || ulang=='y')
goto awal;
else
cout<<" Terima kasih telah membeli di BSI-KALIABANG SHOWROOM ";
getch();
}
#include<conio.h>
#include<iostream.h>
#include<dos.h>
#include<iomanip.h>
#include<windows.h>
judul()
{
cout<<" *BSI-KALIABANG SHOWROOM* " <<endl;
cout<<" Menjual kendaraan Mewah, Elegan & Berkelas" <<endl;
cout<<"------------------------------------------------------------------------"<<endl;
cout<<"Kode Kendaraan Jenis Kendaraan Kode Jenis Merk Harga($)"<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
cout<<" MBL Mobil 1 Lamborghini 10000000"<<endl;
cout<<" 2 Ferrari 8000000"<<endl;
cout<<" 3 Porsche 5000000"<<endl;
cout<<" MTR Motor 1 Harley 1000000"<<endl;
cout<<" 2 Ducati 800000"<<endl;
cout<<" 3 Tomahawk 500000"<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
}
subs()
{
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
cout<<"No. Kode Jenis Merk Harga Jumlah Subtotal "<<endl;
cout<<" Kendaraan Kendaraan ($) Kendaraan "<<endl;
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
}
total_bayar(long totalbayar,long subtotal)
{
return(totalbayar+subtotal);
}
main()
{
struct
{
char kk[10],kp,jk[10],m[15];
int jml;
long biaya,sub;
}
sr[10];
char ketik[]={" TUGAS KELOMPOK ALGORITMA & PEMROGRAMAN BSI-KALIABANG (SHOWROOM)\n"};
int ketik2;
double ketik3;
char nm_petugas[20],nm_pembeli[20],ulang;
int i,jdp;
long totbay =0,ubay,ukem,pajak,afpajak;
awal:
clrscr();
for(ketik2=0;ketik[ketik2]!='\0';ketik2++)
{
printf("%c",ketik[ketik2]);
for(ketik3=0;ketik3<=9999999;ketik3++){
}
}
clrscr();
system ("color 2");
cout<<" Algoritma & Pemrograman " <<endl;
sleep(1);
cout<<" 12.1A.05 " <<endl;
cout<<" Nama NIM " <<endl;
sleep(1);
cout<<" Adjie Krisnandy (12132469) " <<endl;
sleep(1);
cout<<" Umi Kulsum (12131767) " <<endl;
sleep(1);
cout<<" Arief Syafrizal (12131834) " <<endl;
sleep(1);
cout<<" Abdurrahman Al Ghazi (12131837) " <<endl;
sleep(1);
cout<<" Raydatul Fiqri (12137305) " <<endl;
sleep(1);
system("color 9");
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
judul();
sleep(1);
cout<<" Nama Petugas : " ;gets(nm_petugas);
cout<<" Nama Pembeli : " ;gets(nm_pembeli);
cout<<" Jumlah Data Pembelian : " ;cin>>jdp;
for(i=1;i<=jdp;i++)
{
cout<<" Pembelian Ke-"<<i<<endl;
cout<<" Kode Kendaraan [MBL/MTR]: " ;cin>>sr[i].kk;
cout<<" Kode Jenis [1/2/3] : " ;cin>>sr[i].kp;
cout<<" Jumlah Kendaraan : " ;cin>>sr[i].jml;
if(strcmp(sr[i].kk,"MBL")==0 ||strcmp(sr[i].kk, "mbl")==0)
{
strcpy(sr[i].jk,"Mobil");
if(sr[i].kp=='1')
{
strcpy(sr[i].m,"Lamborghini");
sr[i].biaya=10000000;
}
else if(sr[i].kp=='2')
{
strcpy(sr[i].m,"Ferrari");
sr[i].biaya=8000000;
}
else if(sr[i].kp=='3')
{
strcpy(sr[i].m,"Porsche");
sr[i].biaya=5000000;
}
}
if(strcmp(sr[i].kk,"MTR")==0 ||strcmp(sr[i].kk, "mtr")==0)
{
strcpy(sr[i].jk,"Motor");
if(sr[i].kp=='1')
{
strcpy(sr[i].m,"Harley");
sr[i].biaya=1000000;
}
else if(sr[i].kp=='2')
{
strcpy(sr[i].m,"Ducati");
sr[i].biaya=800000;
}
else if(sr[i].kp=='3')
{
strcpy(sr[i].m,"Tomahawk");
sr[i].biaya=500000;
}
}
sr[i].sub=sr[i].biaya*sr[i].jml;
totbay=total_bayar(sr[i].sub,totbay);
pajak=totbay*0.1;
afpajak=totbay+pajak;
}
cout<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
cout<<" Nama Petugas : "<<nm_petugas<<endl;
cout<<" Nama Pembeli : "<<nm_pembeli<<endl;
cout<<"------------------------------------------------------------------------"<<endl;
subs();
for(i=1;i<=jdp;i++)
{
cout<<setiosflags(ios::left)<<setw(7)<<i;
cout<<setiosflags(ios::left)<<setw(10)<<sr[i].kk;
cout<<setiosflags(ios::left)<<setw(12)<<sr[i].jk;
cout<<setiosflags(ios::left)<<setw(13)<<sr[i].m;
cout<<setiosflags(ios::left)<<setw(14)<<sr[i].biaya;
cout<<setiosflags(ios::left)<<setw(8)<<sr[i].jml;
cout<<setiosflags(ios::left)<<setw(8)<<sr[i].sub<<endl<<endl;
}
cout<<"®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®®"<<endl;
cout<<" Total : "<<totbay<<endl;
cout<<" Pajak : "<<pajak<<endl;
cout<<" Total Bayar : "<<afpajak<<endl;
cout<<" Uang Bayar : ";cin>>ubay;
ukem = ubay - afpajak;
cout<<" Uang Kembali : "<<ukem<<endl;
cout<<" INGIN INPUT LAGI [Y/N] : "; cin>>ulang;
if(ulang=='Y' || ulang=='y')
goto awal;
else
cout<<" Terima kasih telah membeli di BSI-KALIABANG SHOWROOM ";
getch();
}
Semoga Bermanfaat
-AK-