(Minggu 5 - sesi 7)
1. Sebuah logika yang akan meminta operator untuk memasukan 4 input numeric. Selanjutnya
sistem akan menerima input dan melakukan proses pengurutan angka dari yang paling kecil.
Sistem kemudian akan memberikan output pada display berupa hasil pengurutan angka
2. Pada sebuah kejuaraan olimpiade loncat indah, ada 10 juri yang akan memberikan penilaian
terhadap loncatan atlet. Nilai yang diberikan adalah antara 1-10 dengan 1 digit angka
dibelakang koma.
Buatlan sebuah logika untuk menerima data nilai dari 10 juri untuk dilakuakn penghitungan
akhir berupa nilai rata-rata. Tampilan dan penghitungan sebagai berikut :
3. Sebuah sistem akan menerima inputan berupa file karyawan sales dengan isian (NAMA, NIP,
TOTAL SALES BULANAN). sistem kemudian akan melakukan penghitungan komisi
terhadap kinerja sales dengan ketentuan sebagai berikut :
sistem akan melakukan penghitungan secara progresif, sebagai contoh komisi yang
didapatkan oleh sales dengan total sales $1200.00 adalah :
sistem akan menghitung seluruh list karyawan pada file dan menambahkan informasi berupa
KOMISI yang disisipkan setelah TOTAL SALES BULANAN. Pengguna aplikasi kemudian
akan bisa mendownload kembali file tersebut.
1.
Defining Diagram
Input Processing Output
list_number
Module :
Sort_number_ascending
1 Perform initial_process
5 Read_Number
Sort_Number
ENDDO
10 print_sorted_number
END
Sub Module:
initial_process
2 set raw_number = 0
3 set list_number = []
4 set x = 1
END
Read_number
6 for x = 1 to 4 do:
read raw_number
list_number[] = raw_number
ENDFOR
END
swap(a,b)
temp = 0
a=temp
a=b
b=temp
END
sort_number
8 loop = list_number.count;
swapped = false
swapped = true
ENDIF
ENDFOR
break
ENDIF
ENDFOR
END
print_sorted_number
print list_number[number]
ENDFOR
END
Desk Checking
INPUT
raw_number
EXPECTED RESULT
list_number
1,2,3,4 0 {} 1
5,6 1 {1} 1
4 {1,4} 2
8 {1,4,8} 3
5 {1,4,8,5} 4
10,11 Print
1,2,3,4 0 {} 1
5,6 2 {2} 1
1 {2,1} 2
3 {2,1,3} 3
4 {2,1,3,4} 4
10,11 Print
2.
Defining Diagram
Pseudocode
Modul Utama
Processing_Average_Score
1 Create_Table
4 WHILE judge<=10
DO Read_Mark
ENDWHILE
9 Calculate_Average
12 Print_Average
Sub Modul
Create_Table
2 create table “jump_marks” with “Judge”, “Mark” as row headings
3 set judge to zero
set total_mark to zero
END
Read_Mark
5 read mark
6 judge= judge+1
7 total_mark = total_mark+mark
8 Create new column
Store values in the table
END
Calculate_Average
10 read total_mark
11 Average = total_mark/10
END
Print_Average
13 print table “jump_marks”
14 Print average
END
Desk Checking
Input data
Set 1
Set 2
Judg 1 2 3 4 5 6 7 8 9 10
e
Mark 5.5 6.0 4.8 6.2 5.4 5.2 4.9 5.0 6.1 5.9
Expected result
Set 1
Set 2
Judg 1 2 3 4 5 6 7 8 9 10
e
Mark 5.5 6.0 4.8 6.2 5.4 5.2 4.9 5.0 6.1 5.9
First Pass
1,2,3 Create 0 0
table
0 11 False
9,10,11 6.81
12,13,14 Print
table,
print
average
Second
Pass
1,2,3 Create 0 0
table
0 11 False
9,10,11 5.5
12,13,14 Print
table,
print
average
3.
Defining Diagram
Employee sales records, which Create table with NAMA, NIP, A new file/record containing
contains: TOTAL SALES BULANAN, KOMISI as the new table
and KOMISI as headings heading
Nama Read sales record in the row
NIP Calculate employee
Total sales bulanan commission
Write commission in the table
Create new file from table to be
downloaded
Modules
Modul untuk melakukan initial processing termasuk membuat table yang akan
memuat data
Modul untuk membaca data dalam record yang di-input dan memasukkannya sebagai
value ke dalam tabel
Modul untuk menghitung komisi karyawan dari data tersebut sekaligus mengupdate
tabel dengan data komisi
Modul untuk mengubah/export tabel menjadi file yang bisa di download
Hierarchy Chart
Pseudocode
Modul Utama
Update_commission
1 Create_table
4 Read_records
Calculate_commission
ENDDO
10 Convert_table
12 Output commission_file
END
Sub-Modul
Create_table
END
Read_records
5 read next employee record from file which consists of nama, nip, monthly_sales
END
Calculate_commission
0.10
ELSE
emp_comm = 200 * 0.05 + (1000 – 200) * 0.08 + (2000 – 1000) * 0.10 +
ENDIF
END
Convert_table
//commission_file format/file type is the same as the original record from input//
END
Desk Checking
Input Data
Expected Result
First Pass
1,2,3 create 0 0
9 42 in 42
first
row
9 114 in 114
second
row
9 234 in 234
third
row
7 FALSE
10 convert crea
11 Outp
Desk Checking