Professional Documents
Culture Documents
TITLE:
DEPARTMENT OF AGRICULTURE AND FOOD INDUSTRIES
LECTURER’S NAME:
DR. YUSNITA BINTI MUHAMAD NOOR
Due to covid-19, Federal Agricultural Malaysia Association (FAMA) had to close office buildings
to avoid contact and decrease daily cases. Since agricultural sector gain an attention from all layers of
society including current generation, FAMA need to propose other easiest and convenient way suitable
with current situation to purchase license which is before this all the applicant who want to buy plant
license need to submit a form to the FAMA office building. FAMA appointed your team to create one
merchant to facilitate all the applicant to apply coconut license and coffee license as a trial programme.
To apply this license, applicants must 18 years and above and Malaysian citizen or permanent resident.
Applicants need to register with a SSM to apply this license.
1 year
License validity
(Terminated 31st December)
Table 1
User’s input
WELCOME TO FAMA MERCHANT
Enter name Alin
Enter identification number (without ‘-‘) 870222065654
Enter age 35
Did you have any license SSM? [Yes: Y No: N] Y
Enter company registered number 521568894-G
Type of license
Output 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int decision(int quantity, int license[10], char ssmnum[10], int age, int ssm, int i,int billicense, float price
);
int licenseQuantity(int license, int quantity, int price, int decision);
int calctotal(int price, float totalpayment);
void output (char name[20], int ic, char ssmnum[10], float totalpayment);
void main()
{
FILE *input;
input=fopen("test,txt", "w");
decision(quantity,license,ssmnum,age,ssm,i,billicense,price);
licenseQuantity(license,quantity, price, decision);
calctotal(price,totalpayment);
output(name,ic,ssmnum,totalpayment);
fclose(input);
int decision(int quantity, int license[10], char ssmnum[10], int age, int ssm, int i,int billicense, float price
)
{
if (age>=18)
{
if (ssm==1)
{
printf("Enter your registration SSM number: ");
scanf("%s", &ssmnum);
for(i=0;i<billicense;i++)
{
printf("\nType type of license:");
printf("\n1: Coconut License");
printf("\n2: Coffee License");
return licenseQuantity;
}
}
else
{
printf("\nSorry you need to registered with SSM first to purchase this license\n");
}
}
else
{
printf("\nSorry you need to above 18 to make a purchase\n");
}
}
void output (char name[20], int ic, char ssmnum[10], float totalpayment)
{
printf("\n-----------------ORDER CONFIRMATION--------------------");
printf("\nName: %s", name);
printf("\nIdentification number (i/c): %d", ic);
printf("\nLicense registered with ssm: %d", ssmnum);
printf("\nTotal Payment: RM%.2f", totalpayment);
}