Вы находитесь на странице: 1из 7

UNIVERSITY TEKNOLOGI MARA

CSC099: Foundation Computing II


Semester 2, Academic Year 2015/2016

INDIVIDUAL ASSIGNMENT (10%)

(Due date: 11th March 2016)

Instructions:
By using your hand writing to show the C source code solutions and submit it at my room
before 5pm.

Question:
Write a full C program that calculates amount Zakat per annum and monthly by using 2 methods
of Zakat calculation. Your program should contain tasks as stated below:

a. main() function
i. function call menuscreen( )
b. menuscreen( ) function without return value
i. User need to choose 3 options.
1. Pay zakat using method 1
2. Pay zakat using method 2
3. Quit
ii. In option 1 consist of function call income ( ) and method1 ( ).
iii. The value of function call income ( ) will be assigned into variable salary.
iv. Function call method1 ( ), received value of variable salary from function call
income ( ).
v. In option 3 program terminated
vi. Input validation: When user enters option other the range 1 to 3, error
message will appear and asked user to re-enter correct option again.
c. income( ) function with return value
i. Prompt user input of their annual salary including bonus/dividend/royalty etc.
ii. Check input enter by user, if value is negative display error message and asked
user to re-enter again.
iii. Value of annual salary is returned.
d. method1( ) function received value annual salary without return value
i. Calculate amount zakat to pay for a year by using formula:
zakat = annual salary x 2.5%
ii. Calculate amount zakat to pay for every month by using formula:
zakat = annual salary x 2.5% / 12
iii. Display amount zakat for a year and a month with 2 decimal places.
iv. Display an option to print the statement by press 1 otherwise program will display
menu screen.
e. method2( ) function received value annual salary with return value
i. Ask user maritial status. Press 1 (yes) and press 0 (no).
ii. Ask user number of kid, amount of money give to parent monthly, and amount of
deposit money at Lembaga Tabung Haji for a year.
iii. Calculate total expenses = 8000 (ownself) + 3000 (wife) + 1000 per kid +
(parent *12) + EPF (annual salary x 11%) + deposit money in Tabung Haji.
Net income eligible to pay for zakat = annual salary total expenses
iv. Display all description on expenses with 2 decimal places
v. Value of net income is returned.
f. print( ) function received value zakat per year and zakat a month without return any
value
i. Display zakat of income statement for a year and a month
ii. program will go back to main screen

Screen shot:
Main Screen

Option 1
Option 2
Appendix:

Source adapted from MAIWP

Вам также может понравиться