You are on page 1of 7

MINI PROJECT BCI1023 (PROGRAMMING TECHNIQUE)

TITLE:
DEPARTMENT OF AGRICULTURE AND FOOD INDUSTRIES

LECTURER’S NAME:
DR. YUSNITA BINTI MUHAMAD NOOR

Matric ID Name Section


SD21017 NURUL HAZLIN BINTI MOHD RADZUAN 01G
SD21046 NORAMERA BINTI AZMAN 02G
SD21050 NUR SYAZREEN BINTI ISMAIL 02G
Case study

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.

Coffee license Coconut License

License fee RM 10.00 RM 12.00

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

1: Coffee License RM 10.00


2: Coconut License RM 12.00

Enter code type of license 1


Enter validity the license [e.g.: 1 = 1 year] 2
Total price RM20.00
Output:
-------------------Confirmation------------------------------
Your name : Alin
Your IC Number : 870222065654
Your Company registration company : 521568894-G
Total price of purchased items : RM 20.00
------------------------------------------------------------------
THANK YOU. PRINT THIS CONFIRMATION AS YOUR COPY.

Enter name Khalil Gufri


Enter identification number 901223025783
Enter age 32
Did you have any license SSM? [Yes: Y No: N] Y
Enter company registered number 021357894-M
Type of license

1: Coffee License RM 10.00


2: Coconut License RM 12.00

Enter code type of license 1


Enter validity the license [e.g.: 1 = 1 year] 1
Total price RM10.00
Output:
-------------------Confirmation------------------------------
Your name : Khalil Gufri
Your IC Number : 901223025783
Your Company registration number : 021357894-M
Total price of purchased items : RM 10.00
------------------------------------------------------------------
THANK YOU. PRINT THIS CONFIRMATION AS YOUR COPY.

Enter name Adriana Misha


Enter identification number 970515045458
Enter age 25
Did you have any license SSM? [Yes: Y No: N] N
Sorry you need to register
with SSM first to apply this
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");

char name[20], ssm, ssmnum[10];


int age,ic, license [100], quantity, purchase;
int i, billicense;
float price, totalpayment=0;

printf("Enter your name: ");


gets(name);
printf("Enter your ic: ");
scanf("%d", &ic);
printf("Enter your age :");
scanf("%d", &age);
printf("Did you have any license registered with SSM? [1:Yes, 0:No]: ");
scanf("%d", &ssm);

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);

printf("\nHow many license you want to purchase?: ");


scanf("%d", &billicense);

for(i=0;i<billicense;i++)
{
printf("\nType type of license:");
printf("\n1: Coconut License");
printf("\n2: Coffee License");

printf("\nEnter code of license you want to purchase: ",i+1);


scanf("%d", &license[i]);

printf("\nEnter validity of license you want to purchase,[1= 1year]: ");


scanf("%d", &quantity);

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");
}
}

int licenseQuantity(int license, int quantity, int price, int decision)


{
if (license==1)
{
price = (quantity*10);
printf("The price of license: %d", price);
}
else if (license==2)
{
price = (quantity*12);
printf("The price of license: %d", price);
}
else
{
printf("\nYou enter wrong code\n");
}
}

int calctotal(int price, float totalpayment)


{
totalpayment=0;
totalpayment= totalpayment + price;
}

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);
}

You might also like