Perulangan
TUGAS 2
Pertemuan 5
Nama : Mochamad Helmy Faiz
Nim : 12200371
Kelas : 12.1A.37
Matkul : Dasar Pemrograman
Program
garispendek = "------------------------------"
garispanjang = "-----------------------------------------"
#Layar Tampilan Awal
print("GEROBAK FRIED CHICKEN")
print(garispendek)
print("Kode Jenis Potongan Harga")
print(garispendek)
print("D Dada Rp. 2500")
print("P Paha Rp. 2000")
print("S Sayap Rp. 1000")
print(garispendek)
banyakData = int(input("\nBanyak Data Yang Diinput : "))
#Deklarasi var list
listKP = []
listBP = []
#Proses Input Data Berulang Sesuai Banyaknya Data
for x in range(banyakData):
print("\nData Ke - ",x+1)
kodePotong = input("Kode Potong [D/P/S] :")
listKP.append(kodePotong)
banyakPotong = int(input("Banyak Potong :"))
listBP.append(banyakPotong)
print(garispendek)
#Output Hasil Inputan
print("GEROBAK FRIED CHICKEN")
print(garispanjang)
print("No. Jenis Harga Jumlah Subtotal")
print(" Potongan Satuan Beli Harga")
print(garispanjang)
#proses dari inputan yang sudah dilakukan
total = 0
for b in range (banyakData):
if(listKP[b]=="D" or listKP[b]=="d"):
JP ="Dada"
harga = 2500
elif(listKP[b]=="P" or listKP[b]=="p"):
JP ="Paha"
harga = 2000
elif(listKP[b]=="S" or listKP[b]=="s"):
JP ="Sayap"
harga = 1000
else:
JP = "---"
harga = 0
subTotal = harga * listBP[b]
total = total + subTotal
print(b+1," ",JP," ",harga," ",listBP[b]," Rp",subTotal)
ppn = int(10/100*total)
totbay = int(total + ppn)
print(garispanjang)
print(" Jumlah Bayar Rp", total)
print(" Pajak 10% Rp", ppn)
print(" Total Bayar Rp", totbay)
Hasil Run
GEROBAK FRIED CHICKEN
------------------------------
Kode Jenis Potongan Harga
------------------------------
D Dada Rp. 2500
P Paha Rp. 2000
S Sayap Rp. 1000
------------------------------
Banyak Data Yang Diinput : 3
Data Ke - 1
Kode Potong [D/P/S] :d
Banyak Potong :10
------------------------------
Data Ke - 2
Kode Potong [D/P/S] :s
Banyak Potong :15
------------------------------
Data Ke - 3
Kode Potong [D/P/S] :p
Banyak Potong :7
------------------------------
GEROBAK FRIED CHICKEN
-----------------------------------------
No. Jenis Harga Jumlah Subtotal
Potongan Satuan Beli Harga
-----------------------------------------
1 Dada 2500 10 Rp 25000
2 Sayap 1000 15 Rp 15000
3 Paha 2000 7 Rp 14000
-----------------------------------------
Jumlah Bayar Rp 54000
Pajak 10% Rp 5400
Total Bayar Rp 59400
Komentar
Posting Komentar