Anda di halaman 1dari 5

#include<stdio.

h>

float income(int option);


void menuscreen();
void method1(float);
float method2(float);
void statement(float, float);
int main()
{
menuscreen();
return 0;
}

void menuscreen()
{
int option;
float salary, x;
printf("\t\t Calculator Zakat of Income \n");
printf("\t\t ************************** \n\n");
do
{
printf("\t 1. Zakat of Income using Method 1\n");
printf("\t 2. Zakat of Income using Method 2\n");
printf("\t 3. Exit\n\n");
printf("User option >> ");
scanf("%d", &option );
if (option<1||option>3)
printf("\n\t INVALID INPUT!!! PLEASE RE-ENTER...\n\n");
}while(option<1||option>3);

if (option==1)
{
salary=income(option);
method1(salary);
}
if (option==2)
{
salary=income(option);
x=method2(salary);
method1(x);
}
}

float income(int option)


{
float salary;
printf("\n\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
printf("\n\nDescription method %d :\n\n", option);
printf("\t\t For this method it will be calculated by using formula:\n\n");
if (option==1)
printf("\t\t\t Annual Gross salary * 2.5 percent\n\n");
if (option==2)
printf("\t\t\t Annual Gross salary - Total Expenses * 2.5 percent\n\n");
printf("Annual gross salary for 2014 including bonus/dividen/royalty/etc :>> RM ");
scanf("%f", &salary);

while (salary<0)
{
printf("\n\t INVALID INPUT!!! PLEASE RE-ENTER...\n\n");
printf("Annual gross salary for 2014 including bonus/dividen/royalty/etc :>> RM ");
scanf("%f", &salary);
}
return salary;
}
void method1(float salary)
{
int print;
float zakat_year, zakat_month;
zakat_year= salary*0.025;
zakat_month= salary*0.025/12;

printf("\n\nAmount Zakat of Income per annum is : RM %.2f \n", zakat_year);


printf("Amount Zakat of Income monthly deduction is : RM %.2f \n", zakat_month);
printf("\n\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
printf("\n\n\nDo you want to print the statement? If YES <press 1> :>> ");
scanf("%d", &print);

if(print==1)
{
statement(zakat_month,zakat_year);
}
else
menuscreen();
}

float method2(float salary)


{
int marry, kids=0;
float parent, TH, total;

printf("\n\nAre you married? Press 1 <YES> / 0 <NO> >> ");


scanf("%d", &marry);
if (marry==1)
{
printf("\n\nHow many kid(s)? >> ");
scanf("%d", &kids);
}
printf("\n\nHow much money do you give to your parent monthly? >> ");
scanf("%f", &parent);
printf("\n\nHow much you deposit to Lembaga Tabung Haji per year? >> ");
scanf("%f", &TH);
printf("\n\nDESCRIPTION ON TOTAL EXPENSES\n");
printf("OWN :RM 8000\n");
if (marry==1)
{
printf("WIFE :RM 3000\n");
printf("KID(S) :RM %d\n", kids*1000);
}
printf("PARENT <PER ANNUM> :RM %.2f\n", parent*12);
printf("EPF-11 percent :RM %.2f\n", salary*0.11);
printf("DEPOSIT <TABUNG HAJI> :RM %.2f\n", TH);
total=8000+(marry*0)+(kids*1000)+(parent*12)+(salary*0.11)+(TH);
printf("TOTAL EXPENSES <ALLOWED> :RM %.2f\n\n", total);

printf("Your nett income after deduction is RM %.2f", salary-total);

return salary-total;
}
void statement(float zakat_month, float zakat_year)
{

printf("\n\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
printf("\n\t\t\t WELCOME... \n\t\t Pusat Zakat Negeri Selangor\n\n");
printf("\t\t----------------------------");
printf("\n\nZakat of Income Statement\n\n");
printf("Monthly zakat deduction is RM %.2f\n", zakat_month);
printf("Amount zakat per annum is RM %.2f", zakat_year);
printf("\n\n\t\t\t THANK YOU!");

printf("\n\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n");
menuscreen();
}

Anda mungkin juga menyukai