You are on page 1of 1

public double calcula

ate(int amount
t)
{
ouble rushCharg
ge = 0;
-1- do
-1- if
f (nextday.equa
als("yes") )
{
-2rushCharge = 14.50;
}
ouble tax = amo
ount * .0725;
-3- do
-3- if
f (amount >= 10
000)
{
06 +
-4shipcharge = amount * .0
arge;
rushCha
}
lse if (amount >= 200)
-5- el
{
08 +
-6shipcharge = amount * .0
arge;
rushCha
}
lse if (amount >= 100)
-7- el
{
shCharge;
-8shipcharge = 13.25 + rus
}
lse if (amount >= 50)
-9- el
{
hCharge;
-10shipcharge = 9.95 + rush
}
lse if (amount >= 25)
-11- el
{
hCharge;
-12shipcharge = 7.25 + rush
}
lse
el
{
hCharge;
-13shipcharge = 5.25 + rush
}
otal = amount + tax + shipch
harge;
-14- to
-14- re
eturn total;
} //end calculat
te

Soal
wgraphnya
1. Gambarflow

2.

3.

Tentukancycclomaticcomplexittydariflowgraph
V(G)=EN++2
=1914
4+2
=7

urindependen
Tentukanjalu
Buatminimal7(berdasarsoaln
no2)jalurindependen
yangmeliputtisemuanode(linggkaran)danedge(garis).
Jalurnyabisaberbeda,inihanyyacontoh:
Jalur1:123579111314
Jalur2:13414
Jalur3:135614
Jalur4:1357814
Jalur5:135791014
Jalur6:13579111214
Jalur7:13579111314

4.

Buaatkasusujinya:
NIlaainyavariablenexttdaydanamountu
untuktiapjalur
(darijawabannomor3)bebas,inihanyyacontoh:
3414
MissalnyaJalur2:13
nextdayharusno
okarenatidaklew
watnode2,
langsungkenode
e3
amountharus>=
=1000karenalewa
atnode4

Jalu
ur Nextday Amount
A
Expected
result
1
Yes
10
0
30.48
2
No
15
500 (diatas1000)
1698.75
3
4
5
6
7

No
No
No
No
No

30
00 (diatas200)
15
50 (diatas100)
75
5 (diatas50)
30
0 (diatas25)
10
0 (lainya)

345.75
174.125
90.3875
39.425
15.975

You might also like