Anda di halaman 1dari 12

Tugas Kelompok ke-2

(Minggu 5 - sesi 7)

Terhadap permasalahan berikut, anda diminta untuk membuat solusi berikut :

 Konstruksi permasalahannya dengan menggunakan defining diagram


 Kelompokkan aktifitas kedalam modules
 Buat hierarchy chart
 Buat logika utama dengan menggunakan pseudocode
 Buat pseudocode untuk setiap succesive module di hierarchy chart
 Desk check terhadap solution algoritm

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.

Referensi : buku utama, bab 8

1.

Defining Diagram
Input Processing Output

raw_number Process Raw Number to list_sorted_number


Sorted Number

- Read 4 Numerical Number

- Sort 4 Numerical Number


Ascendingly

- Print Sorted Number

list_number

Module :

• A module to perform some initial processing before reading number

• A module to read 4 numerical number from input

• A module to sort 4 numerical number ascendingly

• A module to print the result of sorted Number

Sort_number_ascending

Initial_Process Read_Number Sort_Number Print_Sorted_Number

Main Logic Pseudocode:


Sort_number_ascending

1 Perform initial_process

5 Read_Number

7 DOWHILE more raw_number exists

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;

9 for i = 0 to loop -1 do:

swapped = false

for j = 0 to loop-1 do:


if list_number[j] > list_number[j+1] then

swap( list_number[j], list_number[j+1] )

swapped = true

ENDIF

ENDFOR

if swapped = false then

break

ENDIF

ENDFOR

END

print_sorted_number

11 for number = 0 to list_number.length - 1

print list_number[number]

ENDFOR

END

Desk Checking

INPUT

raw_number

First Pass 1,4,8,5

Second Pass 2,1,3,4

EXPECTED RESULT

list_number

First Pass 1,4,5,8

Second Pass 1,2,3,4

Statement raw_numb list_numbe x loop i j swap swapped


# er r condition

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

7,8,9 {1,4,8,5} 4 0 0 FALSE FALSE

{1,4,8,5} 1 FALSE FALSE

{1,4,8,5} 2 FALSE FALSE

{1,4,8,5} 3 FALSE FALSE

{1,4,8,5} 1 2 FALSE FALSE

{1,4,8,5} 3 FALSE FALSE

{1,4,5,8} 2 3 TRUE TRUE

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

7,8,9 {2,1,3,4} 4 0 0 TRUE TRUE

{1,2,3,4} 1 FALSE FALSE

10,11 Print

2.

Defining Diagram

INPUT PROCESS OUTPUT


mark Inisiasi awal dan membuat Average
tabel
Membaca mark (repetition
hingga 10 kali)
Menghitung average=
total score
10
Print tabel dan average
Modules
1. Modul untuk melakukan inisiasi awal dan membuat tabel
2. Modul untuk membaca mark
3. Modul untuk menghitung average
4. Modul untuk menulis rata - rata
Hierarchy Chart

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

Score for the dive 5.5

Statement Table Mark Judge WHILE Total_mark Average Print


Number condition

First Pass

1,2,3 Create 0 0
table

4,5,6,7,8 Create 6.7 1 True 6.7


column,
input
value

8.1 2 True 14.8

5.8 3 True 20.6

7.0 4 True 27.6


6.6 5 True 34.2

6.0 6 True 40.2

7.6 7 True 47.8

6.1 8 True 53.9

7.2 9 True 61.1

7.0 10 True 68.1

0 11 False

9,10,11 6.81

12,13,14 Print
table,
print
average

Second
Pass

1,2,3 Create 0 0
table

4,5,6,7,8 Create 5.5 1 True 5.5


column,
input
value

6.0 2 True 11.5

4.8 3 True 16.3

6.2 4 True 22.5

5.4 5 True 27.9

5.2 6 True 33.1

4.9 7 True 38.0

5.0 8 True 43.0

6.1 9 True 49.1

5.9 10 True 55.0

0 11 False

9,10,11 5.5

12,13,14 Print
table,
print
average

3.

Defining Diagram

Input Process Output

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 yang diperlukan:

 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

7 DOWHILE more records in table exist

Calculate_commission

ENDDO

10 Convert_table

12 Output commission_file

END

Sub-Modul

Create_table

2 create table “commission_table” with “NAMA”, “NIP”, “TOTAL SALES

BULANAN”, “KOMISI” as table columns/headings

3 set monthly_sales to zero

set emp_comm to zero

END

Read_records

5 read next employee record from file which consists of nama, nip, monthly_sales

6 create new rows according to number of records

store values under corresponding columns

END

Calculate_commission

8 Read next commission_table record

9 IF monthly_sales <= 200 THEN

emp_comm = monthly_sales * 0.05

ELSE IF monthly_sales > 200 AND monthly_sales < 1000 THEN

emp_comm = 200 * 0.05 + (monthly_sales – 200) * 0.08

ELSE IF monthly_sales > 1000 AND monthly_sales < 2000 THEN

emp_comm = 200 * 0.05 + (1000 – 200) * 0.08 + (monthly_sales – 1000) *

0.10

ELSE
emp_comm = 200 * 0.05 + (1000 – 200) * 0.08 + (2000 – 1000) * 0.10 +

(monthly_sales – 2000) * 0.12

ENDIF

write emp_comm under “KOMISI” column on the corresponding row

END

Convert_table

11 convert table into commission_file

//commission_file format/file type is the same as the original record from input//

END

Desk Checking

Input Data

Employee sales record

NAMA NIP TOTAL SALES BULANAN

Iskanda 174 $600


r

Ardly 175 $1500

Hanafi 176 $2500

Expected Result

NAMA NIP TOTAL SALES BULANAN KOMISI

Iskanda 174 $600 $42


r

Ardly 175 $1500 $114

Hanafi 176 $2500 $234

Statement Table NAMA NIP monthly_sales DOWHILE emp_comm commiss


Number condition

First Pass

1,2,3 create 0 0

4,5,6 create Iskandar 174 600 0


rows,
input
records

Ardly 175 1500 0

Hanafi 176 2500 0

7,8 Iskandar 174 600 TRUE

9 42 in 42
first
row

7,8 Ardly 175 1500 TRUE

9 114 in 114
second
row

7,8 Hanafi 176 2500 TRUE

9 234 in 234
third
row

7 FALSE

10 convert crea

11 Outp

Desk Checking

Anda mungkin juga menyukai