Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PBO Emi

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

NAMA: Emi lestari

NIM :2136099

MATA PELAJARAN: PEMROGRAMAN BERORIENTASI OBJECT

1. Program Penjualan Minimarket Pada C++

a. Script di Dev C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void garis() {

printf("=====================================================\n");
}

void bintang() {
printf("*****************************************************\n");
}

void minimarket() {
printf("-------------PROGRAM PENJUALAN MINIMARKET------------\n");
}

int main() {
int i, j;
char kode_k, kasir[20], lagi;
long int total_byr = 0, bayar, kembali;
char kode_brg[30];
char barang[30][20];
int harga[30] = {0};
int jml_bel[30];
long int sub_total[30];

atas:
garis();
bintang();
minimarket();
bintang();
garis();
printf("KODE KASIR\n");
printf(" 1. Adit\n");
printf(" 2. Bayu\n");
printf("Masukkan Kode Kasir[1/2] : ");
scanf(" %c", &kode_k);
fflush(stdin);
switch (kode_k) {
case '1':
strcpy(kasir, "Adit");
break;
case '2':
strcpy(kasir, "Bayu");
break;
default:
strcpy(kasir, "Kode Salah");
break;
}
printf("Jumlah item : ");
scanf("%d", &j);
fflush(stdin);
minimarket();
printf("KODE BARANG\n");
garis();
printf("1. Shampoo [S]\n");
printf("2. Sikat Gigi [G]\n");
printf("3. Sabun Mandi [M]\n");
garis();
printf("\n");
for (i = 1; i <= j; i++) {
printf("Data Ke-%d\n", i);
printf("Kode Barang : ");
scanf(" %c", &kode_brg[i]);
fflush(stdin);
printf("Jumlah Beli : ");
scanf("%d", &jml_bel[i]);
fflush(stdin);
garis();
}
for (i = 1; i <= j; i++) {
if (kode_brg[i] == 'S' || kode_brg[i] == 's') {
strcpy(barang[i], "Shampoo");
harga[i] = 15000;
}
else if (kode_brg[i] == 'G' || kode_brg[i] == 'g') {
strcpy(barang[i], "Sikat Gigi");
harga[i] = 5000;
}
else if (kode_brg[i] == 'M' || kode_brg[i] == 'm') {
strcpy(barang[i], "Sabun Mandi");
harga[i] = 9000;
}
else {
strcpy(barang[i], "Kode Salah");
harga[i] = 0;
}
}
garis();
printf(" TOKO BERSIH\n");
printf(" Jl. Jendral Sudirman No. 123\n");
printf(" Jakarta Selatan\n");
garis();
printf("Kasir : %s\n", kasir);
printf("-----------------------------------------------------\n");
printf("No | Barang | Harga | Jumlah | Subtotal\n");
printf("-----------------------------------------------------\n");

2. Penjualan Toko Maju Jaya

b. Script di Dev C++

#include<conio.h>
#include<stdio.h>
#include<iostream>
#include<windows.h>
using namespace std;

int main(){

char kj,ku,*uk,*jns;

float hrg,jml,tot,ukemb,ubyr;

{ ulang:

system("cls");
cout<<" ------------Toko Maju Jaya------------"<<endl;

cout<<" --------Jl.Banjar Km 3, Pasir pangaraian--------"<<endl;

cout<<" --TELP.+6283826584036 kode Pos 63554--"<<endl;


cout<<"======================================="<<endl;

cout<<"*****[PILIHAN PRODUK]*****"<<endl;

cout<<"A.Susu dancow"<<endl;

cout<<" 1.ukuran kecil"<<endl;

cout<<" 2.ukuran sedang"<<endl;

cout<<" 3.ukuran besar "<<endl;

cout<<"B.Susu bendera"<<endl;

cout<<" 1.ukuran kecil"<<endl;

cout<<" 2.ukuran sedang"<<endl;

cout<<" 3.ukuran besar "<<endl;

cout<<"C.Susu SGM"<<endl;

cout<<" 1.ukuran kecil"<<endl;

cout<<" 2.ukuran sedang"<<endl;

cout<<" 3.ukuran besar "<<endl;

cout<<"0.Program Keluar"<<endl;

cout<<"*****************************"<<endl;

cout<<"Masukan kode jenis[A..C] :";cin>>kj;

cout<<"Masukan Kode Ukuran[1..3] :";cin>>ku; switch (kj)

{ case'A': case'a': jns="Dancow"; if (ku=='1') { uk="kecil hrg=15000; }

else if(ku=='2') { uk="sedang hrg=20000 }

elz { uk="besar";hrg=25000; break;

case'B': case'b':

jns="Bendera"; if (ku=='1') { uk="kecil hrg=13500; }

else if(ku=='2' uk="sedang"; hrg=17500; }


else { uk="z hrg=20000; break; case'C': case'c': jns="SGM"; if (ku=='1')

{ uk="kecil"; hrg=15000; }

else if(ku=='2') { uk="sedang"; hrg=16500; }

else { uk="besar"; hrg=2200 } break; }

cout<<"jenis produk ="<<jns<<endl;

cout<<"ukuran kemasan ="<<uk<<endl;

cout<<"Harga =Rp."<<hrg<<endl;

cout<<"masukan Jumlah Beli =";cin>>jml;

tot=hrg*jml;

cout<<"Total Bayar =Rp."<<tot<<endl;

cout<<"Uang bayar =Rp.";cin>>ubyr;

ukemb=ubyr-tot; cout<<"uang kembali

=Rp."<<ukemb<<endl;

cout<<"*********terima Kasih********"<<endl; char lag

menulagi :

cout<<"apakah ingin masuk ke menu lagi (y/t) ?";cin>>lagi;

if(lagi=='y' || lagi=='Y'){goto ulang;} else

if(lagi=='t' || lagi=='T'){goto selesai;} else

{cout<<"\inputkan y/t!!!\n";goto menulagi;}

3. Penjualan kue

c. Script di Dev C++

#include <iostream>
using namespace std;
int main ()
{
char namapembeli[20],kodekue[20],namakue[20];

cout << "Nama : MUHAMMAD RIJAL " <<endl;


cout << "Npm : 2015020039 " <<endl;
cout <<" *******************************" <<endl;
cout <<" PROGRAM PENJUALAN BARANG HARIAN" <<endl;
cout <<" *******************************" <<endl;
cout << "Nama Pembeli = " ; cin >> namapembeli;
cout << "Kode Kue = " ; cin >> kodekue;
cout << "Nama Kue = " ; cin >> namakue;
int hargakue;
cout << "Harga Kue = " ; cin >> hargakue;
int jumlahkue;
cout << "Jumlah Kue = " ; cin >> jumlahkue;
int totalharga = jumlahkue*hargakue;
cout << "Total Harga = " << totalharga <<endl;
cout << "*******************************" <<endl;
int diskon = totalharga-diskon;
if (jumlahkue>=20)
{
diskon = totalharga*20/100;
}
else
{
diskon = 0;
}
cout << "Diskon = Rp. " << diskon <<endl;
cout <<"*******************************" <<endl;
int totalbayar = totalharga-diskon;
cout << "Total Bayar = Rp. "<< totalbayar <<endl;

}
Outputnya
Outputnya
Outputnya

You might also like