You are on page 1of 4

SC025 PROGRAMMING | NURUL BALQIS FATANAH FAHEMI F1T2A MS1617619584

IPO
Input : Gross Salary for 20 staffs
Process : Calculate total collection of fund, total collection by gross salary category,
number of staff by gross salary category
Output : Display total collection of fund, total collection by gross salary category,
number of staff by gross salary category

PSEUDOCODE
START
Set staff=0,staff_A=0,staff_B=0,staff_C=0,total_fundA=0,total_fundB=0,total_fundC=0

Repeat while ( staff<=20 )


Enter gross_salary
if ( gross_salary < 1000 )
fund_A=gross_salary x 0.02
staff_A=staff_A + 1
total_fundA=total_fundA + fund_A
else if ( gross_salary <= 2500 )
fund_B=gross_salary x 0.03
staff_B=staff_B+ 1
total_fundB=total_fundB + fund_B
else
fund_C=gross_salary x 0.05
staff_C=staff_C + 1
total_fundC=total_fundC + fund_C
end if
staff=staff + 1
end repeat
total_fund=total_fundA+total_fundB+total_fundC
display total_fund, total_fundA, total_fundB, total_fundC, staff_A, staff_B, staff_C
END

1
SC025 PROGRAMMING | NURUL BALQIS FATANAH FAHEMI F1T2A MS1617619584

FLOW CHART

START

staff=0, staff_A=0, staff_B=0, staff_C=0,


total_fundA=0, total_fundB=0, total_fundC=0

Enter gross salary

while F total_fund=total_fundA+total_fundB+total_fundC
bil<=20

T
text
Display total_fund, total_fundA,
total_fundB, total_fundC,
staff_A, staff_B, staff_C

END

If T fund_A=gross_salary x 0.02
gross salary<1000 staff_A=staff_A + 1
total_fundA=total_fundA + fund_A

If T fund_B=gross_salary x 0.03
gross salary>=2500 staff_B=staff_B+ 1
total_fundB=total_fundB + fund_B

fund_C=gross_salary x 0.05
staff_C=staff_C + 1
total_fundC=total_fundC + fund_C

2
staff=staff + 1
SC025 PROGRAMMING | NURUL BALQIS FATANAH FAHEMI F1T2A MS1617619584

C++
#include<iostream>
using namespace std;
int main()
{
int staff=1,staff_A=0,staff_B=0,staff_C=0;
double
gross_salary,fundA,fundB,fundC,staffA,staffB,staffC,total_fund,tfund_A=0,tfund_B=0,tfund_
C=0;
cout<<"\n ALIMNAS SDN. BHD";
cout<<"\n";
cout<<"\n";
while(staff<=20)
{
cout<<"Enter gross salary "<<staff<<":";
cin>>gross_salary;
if(gross_salary<1000)
{
fundA=gross_salary*0.02;
staffA=staffA+1;
tfund_A=tfund_A+fundA;
}
else if(gross_salary<=2500)
{
fundB=gross_salary*0.03;
staffB=staffB+1;
tfund_B=tfund_B+fundB;
}
else
{
fundC=gross_salary*0.05;
staffC=staffC+1;

3
SC025 PROGRAMMING | NURUL BALQIS FATANAH FAHEMI F1T2A MS1617619584

tfund_C=tfund_C+fundC;
}
staff=staff+1;
}
total_fund=tfund_A+tfund_B+tfund_C;
cout<<"\ntotal collection of fund : "<<total_fund;
cout<<"\n";
cout<<"\n ########################### ######";
cout<<"\n NUMBER OF STAFF by CATEGORY TOTAL";
cout<<"\n";
cout<<"\nLess Than RM1000 :\t\t\t"<<staffA; cout<<"\t\t\t"<<tfund_A;
cout<<"\nRM1000-RM2500 :\t\t\t"<<staffB; cout<<"\t\t\t"<<tfund_B;
cout<<"\nMore Than RM2500 :\t\t\t"<<staffC; cout<<"\t\t\t"<<tfund_C;

return 0;
}

You might also like