You are on page 1of 32

PENGATURCARAAN BERSTRUKTUR

(MTS 3013)

ASSIGNMENT 2
WAN AHMAD HAZWAN BIN AHMAD SUHAINI
(D20122061855)
MUHAMAD BASYIR BIN MAT NAWI
(D20122061847)
MOHAMAD RIDZUAN BIN ABDULLAH
(D20121059789)
MOHAMAD HARIRE BIN AB HAMID
(D20122061858)


PENSYARAH
PROFESOR MADYA DR. NOR HASBIAH BINTI UBAIDULLAH

FAKULTI SENI, KOMPUTERAN DAN INDUSTRI KREATIF
(FSKIK)



1

SYARIKAT ABCS TAX CALCULATION SYSTEM
1 Problem Analysis:
According to the information given by the Lembaga Hasil Dalam Negeri (LHDN), every
employee will gain a rebate for their annual income tax. The rebate was given to employee as an
exception to their income tax based on information below:
1) Own self rebates is RM5,000.00
2) Wife rebates is RM3,000.00
3) Each child rebates is RM1,000.00 (The limitation of child is 5). The rebate will
be given only to employee with the status lelaki berkahwin or janda.

1.1. Input
Before calculation of the tax of an employee is made up, basic information of employee
is required to determine the process work efficiently and to keep the track and record of
employees activity used to print out a receipt. Below is the input of the system to collect
the employees personal detail:
Nama:
Pendapatan tahunan:
Jantina:
Status (Janda/Duda/Berkahwin/Bujang):
Bil. isteri jika sudah berkahwin:
Bil. anak jika sudah berkahwin/janda:
Status pembayaran zakat (Ya/Tidak):
Jumlah pembayaran zakat jika berstatus Ya: RM

2

1.2. Process
Income Tax:
In process to calculate income tax, a real value of income tax with the exception of given
rebate is required. A formula of the income tax is as below:
INCOME TAX = ANNUAL INCOME TOTAL REBATE

Or with zakat exception (only for people who have paid zakat):
INCOME TAX = ANNUAL INCOME TOTAL REBATE ZAKAT PAYMENT

Tax:
Tax calculation is based on the tax rate below accordingly to the range of income tax:
Income Tax Tax Rate
Less than RM20,000.00 7%
RM20,000.00-RM34,999.99 8%
RM35,000.00-RM74,999.99 10%
RM75,000.00-RM119,999.99 15%
RM120,000.00 and higher 25%

TAX = INCOME TAX TAX RATE

Net Income:
Formula to calculate employees net income is as follow:
NET INCOME = INCOME TAX TAX

3

1.3. Output
Below is the output screen result of calculation that was made after the employees key
in the information into the system.
Nama:
Jantina:
Status:
Bil. isteri:
Bil. anak:
Rebat yang dimiliki:
Pendapatan tahunan:
Zakat:
Pendapatan bercukai:
Kadar cukai:
Cukai dikenakan:
Pendapatan bersih:

4

2 Flowchart:
2.1. Function - main( )
5

2.2. Function - cukai ( )
6


7


8


9


10


11


12

3 Program source code:
1 #include <iostream.h>
2 #include <math.h>
3 int i;
4 float cukai();
5
6 //Function Main
7 main()
8 {
9 float total=0;
10
11 for(i=0;i<20;i++)
12 {
13 total=total+cukai();
14 }
15 cout<<"Total Cukai : RM"<<total<<endl;
16 cout<<"=============================================================="<<endl;;
17
18 }
19 //End Function Main
20
21 //Function Float
22 float cukai()
23 {
24
25 //Declaration
26 string nama;
27 float ptahunan;
28 float pendapatancukai;
29 float cukai;
30 float psebenar;
31 char jantina;
32 char status;
33 char zakat;
34 char rebat;
35 int isteri=0;
36 int anak=0;
37 int jzakat=0;
38 //End Declaration
39
13

40 //Header
41 cout<<"\n";
42 cout<<"===============================================================================";
43 cout<<" Selamat Datang Ke Syarikat ABC !!!";
44 cout<<"\n";
45 cout<<"===============================================================================";
46 cout<<"\n";
47 cout<<"Borang: "<<i+1<<endl<<endl;
48 //End Header
49
50 //Input
51 cout<<"Sila Masukkan Nama Anda : ";
52 cin>>nama;
53
54 cout<<"\n";
55
56
57 cout<<"Sila Masukkan Pendapatan Tahunan Anda : RM";
58 cin>>ptahunan;
59 pendapatancukai = ptahunan - 5000;
60
61
62 cout<<"\n";
63
64 //Do Jantina
65 do
66 {
67
68 cout<<"Masukkan Jantina Anda : L/P";
69 cout<<"\n : ";
70 cin>>jantina;
71
72 }
73 while((jantina != 'l' && jantina != 'L') && (jantina != 'p' && jantina != 'P'));
74 //End Do Jantina
75
76 cout<<"\n";
77
78 if(jantina == 'l' || jantina == 'L')
79 {
80
14

81 //Do Status
82 do
83 {
84
85 cout<<"Sila Masukkan Status Anda Mengikut Kod Yang Diberikan \n\n Duda ==> D \n Berkahwin ==> K
\n Bujang ==> B \n\n : ";
86 cin>>status;
87
88 }
89 while((status != 'd' && status != 'D') && (status != 'k' && status != 'K') && (status != 'b' &&
status != 'B'));
90 //End Do Status
91
92 }
93 else
94 {
95
96 //Do Status
97 do
98 {
99
100 cout<<"Sila Masukkan Status Anda Mengikut Kod Yang Diberikan \n\n Janda ==> J \n
Berkahwin ==> K \n Bujang ==> B \n\n : ";
101 cin>>status;
102
103 }
104 while((status != 'j' && status != 'J') && (status != 'k' && status != 'K') && (status != 'b' &&
status != 'B'));
105 //End Do Status
106
107 }
108
109 //If Jantina dan Status
110 if((jantina == 'l' || jantina == 'L') && (status == 'k' || status == 'K'))
111 {
112 while(isteri == 0)
113 {
114 cout<<"\n";
115 cout<<"Berapa orang isteri : ";
116 cin>>isteri;
117
15

118 //If Isteri
119 if(isteri > 0)
120 {
121
122 pendapatancukai = pendapatancukai-(isteri * 3000);
123
124 }
125 else
126 isteri = 0;
127 }
128 //End If Isteri
129
130 }
131 //End If Jantina dan Status
132
133 //If Status
134 if((jantina == 'l' || jantina == 'L') && (status == 'k' || status == 'K') || (jantina == 'p' ||
jantina == 'P') && (status == 'j' || status == 'J'))
135 {
136
137 do
138 {
139 cout<<"\n";
140 cout<<"Berapa orang anak? : ";
141 cin>>anak;
142
143 //If Anak
144 if(anak > 0 || anak <=5)
145 {
146
147 pendapatancukai = pendapatancukai-(anak * 1000);
148
149 }
150 //End If Anak
151 }
152 while(anak > 5 || anak <= 0);
153
154 }
155 //End If Status
156
157 cout<<"\n";
16

158
159 cout<<"\n";
160
161
162 //If Status and Gender
163
164
165 cout<<"Adakah Anda Telah Membayar Zakat : Y/N \n : ";
166 cin>>zakat;
167
168 cout<<"\n";
169
170 //If Zakat
171 if(zakat == 'Y' || zakat == 'y')
172 {
173
174 cout<<"Jumlah Zakat Yang Dibayar = RM";
175 cin>>jzakat;
176
177 if(jzakat > 0)
178 {
179
180 pendapatancukai = pendapatancukai - jzakat;
181
182 }
183
184 }
185 //End If Zakat
186
187
188 cout<<"\n";
189 cout<<"Maklumat yang dimasukkan adalah :- ";
190 cout<<"\n\n";
191
192 cout<<"==============================================================";
193
194 cout<<"\n";
195
196 cout<<"Nama : "<<nama<<endl;
197
198 //If Jantina
17

199 if(jantina == 'l' || jantina == 'L')
200 {
201
202 cout<<"Jantina : "<<jantina<<" = Lelaki"<<endl;
203
204 }
205 else
206 {
207
208 cout<<"Jantina : "<<jantina<<" = Perempuan"<<endl;
209
210 }
211
212 //End If Jantina
213 cout<<"Status : "<<status<<" = ";
214
215 //If Status
216 if(status == 'j' || status == 'J')
217 {
218
219 cout<<"Janda";
220
221 }
222 else if(status == 'D'|| status == 'd')
223 {
224
225 cout<<"Duda";
226
227 }
228 else if(status == 'K' || status == 'k')
229 {
230
231 cout<<"Berkahwin";
232
233 }
234 else if(status == 'B' || status == 'b')
235 {
236
237 cout<<"Bujang";
238
239 }
18

240 //End If Status
241
242 cout<<"\n";
243
244 //If Rebat
245 if((jantina == 'l' || jantina == 'L') && (status == 'k' || status == 'K'))
246 {
247
248 cout<<"Bilangan isteri : "<<isteri<<endl;
249 cout<<"Bilangan anak : "<<anak<<endl;
250 cout<<"Rebat yang dimiliki : Rebat diri sendiri yang berharga RM5,000.000\n";
251 cout<<" Rebat isteri yang berharga RM3,000.000\n";
252
253 if(anak > 0)
254 {
255
256 cout<<" Rebat anak yang berharga RM1,000.000";
257
258 }
259 }
260 else if((jantina == 'p' || jantina == 'P') && (status == 'j' || status == 'J'))
261 {
262
263 cout<<"Bilangan anak : "<<anak<<endl;
264 cout<<"Rebat yang dimiliki : Rebat diri sendiri yang berharga RM5,000.000\n";
265
266 if(anak > 0)
267 {
268
269 cout<<" Rebat anak yang berharga RM1,000.000";
270
271 }
272
273 }
274 else
275 {
276
277 cout<<"Rebat yang dimiliki : Rebat diri sendiri yang berharga RM5,000.000";
278
279 }
280 //End If Rebat
19

281
282 cout<<"\n";
283
284 cout<<"Pendapatan Tahunan : RM"<<ptahunan<<endl;
285
286
287 //If Zakat
288 if(zakat == 'y' || zakat == 'Y')
289 {
290
291 cout<<"Zakat : RM"<<jzakat<<endl;
292
293 }
294 else
295 {
296
297 cout<<"Zakat : None/Tiada"<<endl;
298
299 }
300 //End Zakat
301
302 cout<<"==============================================================";
303 cout<<"\n\n";
304 cout<<"Cukai pendapatan anda akan dikira dan dipulangkan sekiranya mempunyai baki.";
305 cout<<"\n\n";
306 cout<<"Sila Tunggu....";
307 cout<<"\n\n";
308
309 //End Input
310
311
312
313 //Process
314
315 if(pendapatancukai < 20000)
316 {
317
318 cukai = pendapatancukai * 0.07;
319
320 }
321 else if(pendapatancukai >= 20000 && pendapatancukai < 35000)
20

322 {
323
324 cukai = pendapatancukai * 0.08;
325
326 }
327 else if(pendapatancukai >= 35000 && pendapatancukai < 75000)
328 {
329
330 cukai = pendapatancukai * 0.10;
331
332 }
333 else if(pendapatancukai >= 75000 && pendapatancukai < 120000)
334 {
335
336 cukai = pendapatancukai * 0.15;
337
338 }
339 else
340 {
341
342 cukai = pendapatancukai * 0.25;
343
344 }
345
346 psebenar = pendapatancukai - cukai;
347
348 //End Process
349
350 //Output
351 cout<<"==============================================================";
352 cout<<"\n";
353 cout<<"Pendapatan Tahunan : RM"<<ptahunan<<endl;
354 cout<<"Pendapatan Bercukai adalah : RM"<<pendapatancukai<<endl;
355
356 if(pendapatancukai < 20000)
357 {
358
359 cout<<"Kadar Cukai : 7%";
360
361 }
362 else if(pendapatancukai >= 20000 && pendapatancukai < 35000)
21

363 {
364
365 cout<<"Kadar Cukai : 8%";
366
367 }
368 else if(pendapatancukai >= 35000 && pendapatancukai < 75000)
369 {
370
371 cout<<"Kadar Cukai : 10%";
372
373 }
374 else if(pendapatancukai >= 75000 && pendapatancukai < 120000)
375 {
376
377 cout<<"Kadar Cukai : 15%";
378
379 }
380 else
381 {
382
383 cout<<"Kadar Cukai : 25%";
384
385 }
386
387 cout<<"\n";
388 cout<<"Cukai : RM"<<cukai<<endl;
389 cout<<"Pendapatan Sebenar adalah : RM"<<psebenar<<endl;
390
391 return cukai;
392 //End Output
393
394
395 }
396 //End Function Float
22

Testing phase:
System guide and function

Figure 1.1: The main interface of the tax calculation system for Syarikat ABC

23

The Figure 1.1 above shown a system operates at a first run. Firstly, user needs to enter their
identity or name then enter the annual income. Next, the user will be prompt to enter gender. If
the user enters L or l the status menu will appear as a guide. If the inputted data is different
than stated, the system will prompt a user to enter the exact same thing. The status menu which
appear after the user key in L or l is display such figure below:

Figure 1.2: Status menu screen for a person with gender lelaki
If the user enters P or p at gender prompt the different status menu will appear. The
example of screen as below:

Figure 1.3: Status menu screen for a person with gender perempuan
On Figure 1.2 and Figure 1.3, user is allowed only to enter character from k, K, b, B only
for both gender and d, D for lelaki or j, J for perempuan. If any other character were inputted
on system other than specified, the system will display the same status menu.
In this status menu, if user lelaki enter key for status berkahwin, the system will
prompt the user about the total of wife that shown on Figure 1.4 below:

Figure 1.4: System prompt for total of wife the man has been married to.
24

Based on Figure 1.4 after the system prompt of the total of wife, then the user need to
specify the total of child they have. From Figure 1.3 also, if perempuan with the status janda
is being selected by the user, they also will require to specify the total of child. The maximum
number of child entered shouldnt higher than 5 if not user will required to enter it again at the
next prompt. The other option that were stated on the status menu will directly proceed to the
next prompt except for status janda or lelaki berkahwin. The last input for the system is about
zakat payment. User need to choose either Y/N at this prompt. Enter Y/y to go to next
prompt and enter the unit payment or N/n to skip the option.

25

System overview:

Figure 2.1: Output screen for gender lelaki with status bujang

26


Figure 2.2: Output screen for gender lelaki with status berkahwin

27


Figure 2.3: Output screen for gender lelaki with status duda

28


Figure 2.4: Output screen for gender perempuan with status bujang

29


Figure 2.5: Output screen for gender perempuan with status janda

30


Figure 2.6: Output screen for gender perempuan with status berkahwin

31


Figure 2.7: Output screen with the total cukai is displayed for the 20
th
user.

You might also like