SEMESTER 1
LOGIKA & ALGORITMA
TUGAS TELOMPOK PERTEMUAN 4
# KELOMPOK SILENT TEAM #
1. HARIS SYAEFUL AMRI [NIM : 13190183]
2. PATAR SAMUEL [NIM : 13190497]
2. PATAR SAMUEL [NIM : 13190497]
3. IKHWAN HAFIZH [NIM : 13190090]
4. MULYANSYAH YUSUF [NIM : 13190088]
5. SOLIKIN [NIM : 13190515]
KELAS : 13.1B.07
JURUSAN : TEKNIK KOMPUTER
1. Buatlah flowchart dan program dari pseudocode berikut :
a. Masukan kode barang
b. Masukan harga barang
c. Masukan Jumlah barang
d. Hitung bayar = harga * Jumlah barang
e. Jika bayar >= 100.000 maka diberikan discount 10%, selain dari itu tidak mendapat discount
f. Hitung total bayar = bayar – discount
g. Cetak total bayar
Jawaban :
Flowchart :
Program Menggunakan Borland c++ 5.02
Input Script :
#include<iostream>
#include<conio.h>
#include<string>
main()
{
string kode;
int harga, total,totalbayar;
char*nama;
int jumlah, dis;
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"==========LIST KODE BARANG=========="<<endl;
cout<<"001 - Seragam"<<endl;
cout<<"002 - Sepatu"<<endl;
cout<<"003 - Tas Sekolah"<<endl;
cout<<"004 - Buku Tulis"<<endl;
cout<<"===================================="<<endl;
cout<<"Masukan Kode Barang : ";
cin>>kode;
cout<<"jumlah Barang : ";
cin>>jumlah;
if (kode=="001")
{
nama="Seragam";
cout<<"Nama Barang : "<<nama<<endl;
cout<<"Harga Barang : Rp. ";
cin>>harga;
total=harga*jumlah;
}
else if (kode=="002");
{
nama="Sepatu";
cout<<"Nama Barang : "<<nama<<endl;
cout<<"Harga Barang : Rp. ";
cin>>harga;
total=harga*jumlah;
}
//Lebih dari 100ribu diskon 10%//
if (total>100000)
{
dis=(total*10)/100;
totalbayar=total-dis;
cout<<endl;
cout<<"===Anda Mendapatkan Disko 10% ======"<<endl;
cout<<"Total Harga Barang : Rp. "<<totalbayar;
}
//Kurang dari 100Ribu tidak diskon//
else if (total<100000)
{
cout<<"==================================="<<endl;
cout<<"Total Harga Barang : Rp. "<<total;
}
getch();
}
#include<conio.h>
#include<string>
main()
{
string kode;
int harga, total,totalbayar;
char*nama;
int jumlah, dis;
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"==========LIST KODE BARANG=========="<<endl;
cout<<"001 - Seragam"<<endl;
cout<<"002 - Sepatu"<<endl;
cout<<"003 - Tas Sekolah"<<endl;
cout<<"004 - Buku Tulis"<<endl;
cout<<"===================================="<<endl;
cout<<"Masukan Kode Barang : ";
cin>>kode;
cout<<"jumlah Barang : ";
cin>>jumlah;
if (kode=="001")
{
nama="Seragam";
cout<<"Nama Barang : "<<nama<<endl;
cout<<"Harga Barang : Rp. ";
cin>>harga;
total=harga*jumlah;
}
else if (kode=="002");
{
nama="Sepatu";
cout<<"Nama Barang : "<<nama<<endl;
cout<<"Harga Barang : Rp. ";
cin>>harga;
total=harga*jumlah;
}
//Lebih dari 100ribu diskon 10%//
if (total>100000)
{
dis=(total*10)/100;
totalbayar=total-dis;
cout<<endl;
cout<<"===Anda Mendapatkan Disko 10% ======"<<endl;
cout<<"Total Harga Barang : Rp. "<<totalbayar;
}
//Kurang dari 100Ribu tidak diskon//
else if (total<100000)
{
cout<<"==================================="<<endl;
cout<<"Total Harga Barang : Rp. "<<total;
}
getch();
}
Output Program :
2. Buatlah flowchart dan programnya dari pseudocode berikut ini :
a. Diketahui phi=3.14
b. Masukan nilai jari-jari (r)
c. Hitung Keliling = 2 * phi * r
d. Cetak Keliling
e. Ingin menghitung kembali? Jika Ya maka kembali ke proses awal, jika Tidak maka program berhenti.
Jawaban :
Flowchart :
Program Menggunakan Borland c++ 5.02
Input Script :
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
int r,k;
float phi=3.14;
char pil;
clrscr();
pilihlagi:
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<" PROGRAM MENGHITUNG KELILING LINGKARAN "<<endl;
cout<<"____________________________________"<<endl;
cout<<"Masukan nilai jari-jari(r) = ";cin>>r;
k=2*phi*r;
cout<<"Keliling Lingkaran = "<<k<<endl;
cout<<"____________________________________"<<endl;
cout<<"Ingin Menghitung Kembali(Y/T) ? ";cin>>pil;
if(pil == 'Y' || pil == 'y')
{
clrscr();
goto pilihlagi;}
else
cout<<"\n";
getch();
}
#include<conio.h>
#include<iostream.h>
main()
{
int r,k;
float phi=3.14;
char pil;
clrscr();
pilihlagi:
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<" PROGRAM MENGHITUNG KELILING LINGKARAN "<<endl;
cout<<"____________________________________"<<endl;
cout<<"Masukan nilai jari-jari(r) = ";cin>>r;
k=2*phi*r;
cout<<"Keliling Lingkaran = "<<k<<endl;
cout<<"____________________________________"<<endl;
cout<<"Ingin Menghitung Kembali(Y/T) ? ";cin>>pil;
if(pil == 'Y' || pil == 'y')
{
clrscr();
goto pilihlagi;}
else
cout<<"\n";
getch();
}
Output Program :
3. Buatlah flowchart dan programnya dari pseudocode berikut ini:
a. ika pilihan = 1 maka menu =“nasi goreng” Jika pilihan = 2 maka menu =“mie goreng” Jika pilihan = 3 maka menu =“capcay”
b. Cetak menu
c. Ingin pilih kembali? Jika Ya maka kembali ke proses awal, jika Tidak maka program berhenti.
Jawaban :
Flowchart :
Program Menggunakan Borland c++ 5.02
Input Script :
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
main()
{
char lagi;
int menu;
atas:
cout<<endl;
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"***** WARUNG MAKAN SUDI MAMPIR ***** "<<endl;
cout<<"************************************ "<<endl;
cout<<"Pilihan Menu : "<<endl;
cout<<"1. Nasi Goreng"<<endl;
cout<<"2. Mie Goreng"<<endl;
cout<<"3. Capcay"<<endl;
cout<<"************************************ "<<endl;
cout<<"\nMasukan Pilihan[1/2/3]:";cin>>menu;
switch(menu)
{
case 1:
cout<<"\nMenu yang anda pesan adalah Nasi Goreng"<<endl;
break;
case 2:
cout<<"\nMenu yang anda pesan adalah Mie Goreng"<<endl;
break;
case 3:
cout<<"\nMenu yang anda pesan adalah Capcay"<<endl;
break;
default:
cout<<"Anda Salah Memasukan Kode"<<endl;
break;
}
printf("\n\nApakah anda ingin memilih kembali [Y/T] : ");
lagi = getche() ;
if (lagi == 'Y' || lagi == 'y')
goto atas;
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
char lagi;
int menu;
atas:
cout<<endl;
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"***** WARUNG MAKAN SUDI MAMPIR ***** "<<endl;
cout<<"************************************ "<<endl;
cout<<"Pilihan Menu : "<<endl;
cout<<"1. Nasi Goreng"<<endl;
cout<<"2. Mie Goreng"<<endl;
cout<<"3. Capcay"<<endl;
cout<<"************************************ "<<endl;
cout<<"\nMasukan Pilihan[1/2/3]:";cin>>menu;
switch(menu)
{
case 1:
cout<<"\nMenu yang anda pesan adalah Nasi Goreng"<<endl;
break;
case 2:
cout<<"\nMenu yang anda pesan adalah Mie Goreng"<<endl;
break;
case 3:
cout<<"\nMenu yang anda pesan adalah Capcay"<<endl;
break;
default:
cout<<"Anda Salah Memasukan Kode"<<endl;
break;
}
printf("\n\nApakah anda ingin memilih kembali [Y/T] : ");
lagi = getche() ;
if (lagi == 'Y' || lagi == 'y')
goto atas;
getch();
}
Output Program :
4. Buatlah Algoritma dengan program untuk menentukan total Pembayaran sewa rental Film dengan ketentuan berikut ini:
Kode Film diinputkan. Untuk total didapatkan dari lama sewa dikali Harga Sewa, jika lama sewa lebih dari 10 hari maka akan mendapatkan potongan 10% dari total. Dan untuk total bayar didapat dari total – potongan.
Program Menggunakan Borland c++ 5.02
Input Script :
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
int sewa,total,tbayar,diskon,harga;
char kode,*ket,*judul,lagi;
atas:
clrscr();
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"************* PROGRAM RENTAL DVD **************"<<endl;
cout<<" _____________________________________________"<<endl;
cout<<"|Kode | Judul Film |Harga sewa/Hari|"<<endl;
cout<<" _____________________________________________"<<endl;
cout<<"| A |Ayat-ayat Cinta |Rp. 15.000 |"<<endl;
cout<<"| H |Hantu Setan Manggarai |Rp. 12.500 |"<<endl;
cout<<"| J |James Bond |Rp. 12.000 |"<<endl;
cout<<"| D |Drop Out |Rp. 10.000 |"<<endl;
cout<<"| K |Kungfu Panda |Rp. 8.500 |"<<endl;
cout<<" _____________________________________________\n"<<endl;
cout<<"Masukan Kode Film : ";cin>>kode;
cout<<"Masukan Lama Sewa : ";cin>>sewa;
cout<<"Hari"<<endl;
clrscr();
if(kode=='a'||kode=='A')
{harga=15000;
judul="Ayat-ayat Cinta";}
else if(kode=='h'||kode=='H')
{harga=12500;
judul="Hantu Setan Manggarai";}
else if(kode=='j'||kode=='J')
{harga=12000;
judul="James Bond";}
else if(kode=='d'||kode=='D')
{harga=10000;
judul="Drop Out";}
else if(kode=='k'||kode=='K')
{harga=8500;
judul="Kungfu Panda";}
else
harga=0;
total=harga*sewa;
if(sewa>10)
{ket="Selamat, Anda Mendapatkan Diskon 10%";
diskon=total*0.1;}
else
{ket="Selamat, Anda Mendapatkan Diskon 0%";
diskon=total*0;}
tbayar=total-diskon;
cout<<"---------------------------------"<<endl;
cout<<"Kode : "<<kode<<endl;
cout<<"Judul Film : "<<judul<<endl;
cout<<"Lama Sewa : "<<sewa;
cout<<"Hari"<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Harga Sewa/Hari : Rp. "<<harga<<endl;
cout<<"Diskon : "<<ket<<endl;
cout<<"Total Bayar : Rp. "<<tbayar<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Ingin Input Data Lagi?";cin>>lagi;
if(lagi=='y'||lagi=='Y')
goto atas;
getch();
}
#include<conio.h>
#include<iostream.h>
main()
{
int sewa,total,tbayar,diskon,harga;
char kode,*ket,*judul,lagi;
atas:
clrscr();
cout<<" # KELOMPOK SILENT TEAM # "<<endl;
cout<<" ===================================="<<endl;
cout<<" |NO| NAMA | NIM |"<<endl;
cout<<" ===================================="<<endl;
cout<<" |1 | HARIS SYAEFUL AMRI | 13190183 |"<<endl;
cout<<" |2 | PATAR SAMUEL | 13190497 |"<<endl;
cout<<" |3 | IKHWAN HAFIZH | 13190090 |"<<endl;
cout<<" |4 | MULYANSYAH YUSUF | 13190088 |"<<endl;
cout<<" |5 | SOLIKIN | 13190515 |"<<endl;
cout<<" ===================================="<<endl;
cout<<" KELAS : 13.1B.07 "<<endl;
cout<<" JURUSAN : TEKNIK KOMPUTER "<<endl;
cout<<" TAHUN AJARAN : 2019/2020 "<<endl;
cout<<endl;
cout<<"************* PROGRAM RENTAL DVD **************"<<endl;
cout<<" _____________________________________________"<<endl;
cout<<"|Kode | Judul Film |Harga sewa/Hari|"<<endl;
cout<<" _____________________________________________"<<endl;
cout<<"| A |Ayat-ayat Cinta |Rp. 15.000 |"<<endl;
cout<<"| H |Hantu Setan Manggarai |Rp. 12.500 |"<<endl;
cout<<"| J |James Bond |Rp. 12.000 |"<<endl;
cout<<"| D |Drop Out |Rp. 10.000 |"<<endl;
cout<<"| K |Kungfu Panda |Rp. 8.500 |"<<endl;
cout<<" _____________________________________________\n"<<endl;
cout<<"Masukan Kode Film : ";cin>>kode;
cout<<"Masukan Lama Sewa : ";cin>>sewa;
cout<<"Hari"<<endl;
clrscr();
if(kode=='a'||kode=='A')
{harga=15000;
judul="Ayat-ayat Cinta";}
else if(kode=='h'||kode=='H')
{harga=12500;
judul="Hantu Setan Manggarai";}
else if(kode=='j'||kode=='J')
{harga=12000;
judul="James Bond";}
else if(kode=='d'||kode=='D')
{harga=10000;
judul="Drop Out";}
else if(kode=='k'||kode=='K')
{harga=8500;
judul="Kungfu Panda";}
else
harga=0;
total=harga*sewa;
if(sewa>10)
{ket="Selamat, Anda Mendapatkan Diskon 10%";
diskon=total*0.1;}
else
{ket="Selamat, Anda Mendapatkan Diskon 0%";
diskon=total*0;}
tbayar=total-diskon;
cout<<"---------------------------------"<<endl;
cout<<"Kode : "<<kode<<endl;
cout<<"Judul Film : "<<judul<<endl;
cout<<"Lama Sewa : "<<sewa;
cout<<"Hari"<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Harga Sewa/Hari : Rp. "<<harga<<endl;
cout<<"Diskon : "<<ket<<endl;
cout<<"Total Bayar : Rp. "<<tbayar<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Ingin Input Data Lagi?";cin>>lagi;
if(lagi=='y'||lagi=='Y')
goto atas;
getch();
}
Output Program :
No comments:
Post a Comment