Nama : Raihan Ramadhan
NIM : 3420210009
Prodi : Teknik Informatika
Lampiran Tugas 4.1
Script Tugas 4.1
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
// Nama : Raihan ramadhan
// Nim : 3420210009
// Prodi : Teknik Informatika
void main()
{
char kode,lagi;
//Deklarasi Label
atas:
clrscr();
cout<<"MASUKAN KODE MENU [A/B/C]: " ;
kode = getche();
cout<<'\n';
switch (kode) {
case 'A': case 'a':
cout<<"Makanan"; break;
case 'B': case 'b':
cout<<"Minuman"; break;
case 'C': case 'c':
cout<<"Dessert"; break;
default:
cout<<"Anda Salah Memasukan Kode";
}
cout<<'\n';
cout<<"\nIngin Pilih Lagi [Y/T]: ";
lagi = getche();
if(lagi == 'Y' || lagi == 'y') goto atas;
cout<<"\nTerima Kasih ";
getch();
}
Lampiran Tugas 4.2
Script Tugas 4.2
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
//Nama : Raihan ramadhan
//NIM : 3420210009
//Prodi : Teknik Informatika
void main()
{
char kode,lagi; char nama[50],bonus[50];
int jml; float harga,total,pot,ppn,grand;
lagi:
clrscr();
printf("Masukan Kode Buku [1/2/3]: ");cin>>kode;
printf("Jumlah Pembelian Buku : ");cin>>jml;
switch (kode) {
case '1':
strcpy(nama,"The Lord Of The Rings");harga=50000;
break;
case '2':
strcpy(nama,"The Codex Leicester");harga=80000;
break;
default:
strcpy(nama,"Magnan Carta");harga=65000;
}
total = harga * jml; ppn = 0.1 * total;
if(jml>10) {
strcpy(bonus,"Piring Cantik");
pot = 0.1 * total;
} else {
strcpy(bonus,"Maaf Tidak Dapat Bonus");
pot = 0;
}
grand = total + ppn - pot;
clrscr();
puts(" ***TOKO BUKU ORAMEDIA***");
puts(" Jl.Buntu No.32");
puts("---------------------------------------------");
cout<<"Nama Buku : "<<nama<<endl;
cout<<"Harga Buku : "<<harga<<endl;
cout<<"Bonus : "<<bonus<<endl;
cout<<"Total Bayar : "<<total<<endl;
cout<<"Potongan : "<<pot<<endl;
cout<<"PPN : "<<ppn<<endl;
cout<<"Grand Total : "<<grand<<endl;
puts("---------------------------------------------");
puts(" ***THANK YOU***");
cout<<" Mau Order Lagi...?";cin>>lagi;
if (lagi == 'Y' || lagi=='y') {goto lagi; }
getch();
}
Lampiran Tugas 4.3
Script Tugas 4.3
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : raihan ramadhan
//NIM : 3420210009
//Prodi : Teknik Infomartika
void main()
{
char nama[50],tipe[50],souvenir[50];
char kode,lagi;
int lama;
float harga,total,admin=225000,ubay,ukem;
awal:
clrscr();
puts(" PARADISE RESORT");
puts("********************************");
cout<<"Nama Penyewa : ";cin>>nama;
cout<<"Kode Kamar [A/B/C]: ";cin>>kode;
if (kode == 'A' || kode == 'a')
{
strcpy(tipe,"HIGH CLASS");
harga = 270000;
}
else if (kode == 'B' || kode == 'b')
{
strcpy(tipe,"MEDIUM CLASS");
harga = 150000;
}
else if (kode == 'C' || kode == 'c')
{
strcpy(tipe,"ECONOMY CLASS");
harga = 70000;
}
else
{
puts("******************************");
cout<<"Kode kamar yang anda masukan salah, ingin input lagi?";
cin>>lagi;
switch(lagi)
{
case 'Y':
case 'y':
goto awal;
default:
goto akhir;
}
}
clrscr();
puts(" PARADISE RESORT");
puts("********************************");
cout<<"Nama Penyewa : "<<nama<<endl;
cout<<"Kode Kamar [A/B/C]: "<<kode<<endl;
cout<<"Lama Menginap : ";cin>>lama;
puts("******************************");
if (lama>=7)
{
strcpy(souvenir,"Gantungan Kunci");
}
else
{
strcpy(souvenir,"Tidak Dapat");
}
total = (harga*lama)+admin;
cout<<"Tipe Kamar \t\t: "<<tipe<<endl;
cout<<"Lama Menginap \t\t: "<<lama<<"hari"<<endl;
cout<<"Souvenir \t\t: "<<souvenir<<endl;
printf("Biaya Sewa \t\t: Rp.%2.2f \n",harga);
printf("Biaya Administrasi \t: Rp.%2.2f \n",admin);
printf("Total Biaya Sewa \t: Rp.%2.2f \n",total);
puts("******************************");
cout<<"Uang Bayar: ";cin>>ubay;
ukem = ubay - total;
cout<<"Uang kembali:"<<ukem<<endl;
cout<<"Ingin input lagi [Y/N] ";cin>>lagi;
switch(lagi)
{
case 'Y':
case 'y':
goto awal;
default:
goto akhir;
}
akhir:
getch();
}
Terima Kasih.
Wasalamu'alaikum Wr. Wb
Komentar
Posting Komentar