• Tidak ada hasil yang ditemukan

The scope of the system

N/A
N/A
Protected

Academic year: 2018

Membagikan "The scope of the system"

Copied!
23
0
0

Teks penuh

(1)

Structured Programming

Mini Project

CSC138

Name

:Mohamad Afia

bin Hamiah

ID Matrik

:

2010662498

Course

:Diploma Computer

Science

Group

:CSD2Af

Project name

: Staf

Registration

(2)

Lecturer name

:Pn. Elly

Johana

(3)

Chapter 1: Introduction

Introduction

This program purpose is for staf registration for any company to hire the best staf. Some company did interiieo and they oant a system to automatically display the best staf to hire. They also oant to display the staf education and balanced it oith interiieo test.

This program oill calculate interiieo test that already did before in the company. It oill add extra marks for higher education that the staf take before. So, the program is the best solution for any company to automatically hire a oorker based on their education and interiieo test.

Objective

To display the best staf registration based on their education and interiieo test

The scope of the system

(4)

Chapter 2 : Project Analysis

Input

Staf ID

Staf Name

Staf Education

Marks for interiieo

Process

Calculate the addition test 1 and test 2

Calculate addition of bonus marks for education

Calculate the percentage of total marks

Output

Display Staf ID, Staf Name, Education, Test 1, Test 2, Total Marks and percentage

(5)

Chapter 3: Project Design

Pseudocode

Start

const int siie = 2;

struct Staf {

int staff_ic; char name[100]; int edu;

char education[100];

};

struct Marks {

float test[2]; float total; int percentage; };

ioid Input(Staf [], Marks [], intf); ioid Calcf_TotalMarks(Marks [], intf); ioid Display(Staf [], Marks [], intf); ioid Percent(Marks [], intf);

ioid Highestf_Mark(Staf [], Marks [], intf); ioid Writef_File(Staf [], Marks [], intf);

float highest = 0.0; char name[100]; int ID;

char education[100];

ioid main(f) {

Staf s[siie]; Staf p[siie]; int x;

Marks m[siie]; Marks q[siie];

cout<<"Staf Registration -selecting best staf to hire-\n" << endl;

(6)

{

p[x] = &s[x]; q[x] = &m[x]; }

Input(p, q, siief);

Calcf_TotalMarks(q, siief);

for(x=0;x<siie;x++f) {

if (p[x]->edu==1f) {

q[x]->total= q[x]->total + 10; strcpy(p[x]->education,"SPM "f); }

else if (p[x]->edu==2f) {

q[x]->total= q[x]->total + 20; strcpy(p[x]->education,"Diploma"f); }

else if (p[x]->edu==3f) {

q[x]->total= q[x]->total + 30; strcpy(p[x]->education,"Degree"f); }

else if (p[x]->edu==4f) {

q[x]->total= q[x]->total + 40; strcpy(p[x]->education,"Master"f); }

else if (p[x]->edu==5f) {

q[x]->total= q[x]->total + 50; strcpy(p[x]->education,"PhD "f); }

}

Percent(q, siief); Display(p, q, siief);

Highestf_Mark(p, q, siief); Writef_File(p, q, siief);

cout<<endl;

}

ioid Input(Staf p[], Marks q[], int siief) {

int x, y;

for(x=0; x<siie; x++f) {

(7)

cin>>p[x]->staff_ic;

cout<<"Enter Staf Name:"; cin>>os;

cin.getline(p[x]->name, 100f);

cout<<"Enter Staf Education:"<<endl;

cout<<"(SPM:1,Diploma:2,Degree:3,Master:4,PhD:5:"; cin>>p[x]->edu;

cout<<"Enter marks from interiieo - Test 1 & Test 2:"; for(y=0; y<2; y++f)

{

ioid Calcf_TotalMarks(Marks q[], int siief) {

int x, y;

for(x=0; x<siie; x++f) { q[x]->total = 0.0;

for(y=0; y<2; y++f) {

q[x]->total= q[x]->total + q[x]->test[y]; }

}

}

ioid Display(Staf p[], Marks q[], int siief) {

int x, y;

cout<<"ID"<<"\t"<<"Name"<<"\t"<<"Education"<<"\t"<<"Test 1"<<"\t"<<"Test 2"<<"\t"<<"Total Marks"<<"\t"<<"Percentage"<<endl;

cout<<"======================================== ============================="<<endl;

for(x=0; x<siie; x++f) {

cout<<p[x]->staff_ic<<"\t"<<" "; cout<<p[x]->name<<"\t"<<" "; cout<<p[x]->education<<"\t"<<" "; for(y=0; y<2; y++f)

{

cout<<q[x]->test[y]<<"\t"<<" "; }

cout<<q[x]->total<<"\t"<<"\t"<<q[x]->percentage<<"%"; cout<<endl;

(8)

}

ioid Highestf_Mark(Staf p[], Marks q[], int siief) {

int x;

for(x=0; x<siie; x++f) {

if(q[x]->total> highestf) {

highest = q[x]->total; strcpy(name, p[x]->namef); ID = p[x]->staff_ic;

strcpy(education, p[x]->educationf); }

}

cout<<endl;

cout<<"Best staf to hire:"<<endl;

cout<<"==================="<<endl; cout<<"Staf Name:"<<name<<endl;

cout<<"Staf ID:"<<ID<<endl;

cout<<"Education:"<<education<<endl;

}

ioid Percent(Marks q[], int siief) {

int x;

for(x=0; x<siie; x++f) {

q[x]->percentage = (q[x]->total/250f) 100; }

}

ioid Writef_File(Staf p[], Marks q[], int siief) {

ofstream outfle;

outfle.open("C:\\hire.txt"f);

int x, y;

outfle<<"ID"<<"\t"<<"Name"<<"\t"<<"Education"<<"\t"<<"Test 1"<<"\t"<<"Test 2"<<"\t"<<"Total Marks"<<"\t"<<"Percentage"<<endl;

outfle<<"======================================= =============================="<<endl;

for(x=0; x<siie; x++f) {

(9)

outfle<<p[x]->education<<"\t"<<" "; for(y=0; y<2; y++f)

{

outfle<<q[x]->test[y]<<"\t"<<" "; }

outfle<<q[x]->total<<"\t"<<"\t"<<q[x]->percentage<<"%"; outfle<<endl;

}

outfle<<endl;

outfle<<"Best staf to hire:"<<endl;

outfle<<"==================="<<endl; outfle<<"Staf Name:"<<name<<endl;

outfle<<"Staf ID:"<<ID<<endl;

outfle<<"Education:"<<education<<endl;

outfle.close(f);

}

(10)

Flowchart

Start

const int siie = 2; struct Staf

struct Marks

ioid Input(Staf [], Marks [], intf); ioid Calcf_TotalMarks(Marks [], intf); ioid Display(Staf [], Marks [], intf); ioid Percent(Marks [], intf);

ioid Highestf_Mark(Staf [], Marks [], intf); ioid Writef_File(Staf [], Marks [], intf); float highest = 0.0;

char name[100]; int ID;

char education[100]; ioid main(f)

Staf s[siie]; Staf p[siie]; int x;

Marks m[siie]; Marks q[siie];

Enter Staf ID Enter Staf Name Enter Staf Education SPM:1,Diploma:2,Degree: 3,Master:4,PhD:5

Enter marks from

interiieo - Test 1 & Test 2:"; q[x]->total= q[x]->total +

10;

strcpy(p[x]->education,"SPM"f);

q[x]->total= q[x]->total + 20;

(11)

1 2

if

(p[x]->edu==3f) q[x]->total= q[x]->total + 20;

strcpy(p[x]->education," Degree"f);

if

(p[x]->edu==4f) q[x]->total= q[x]->total + 20;

strcpy(p[x]->education," Master"f);

if

(p[x]->edu==5f) q[x]->total= q[x]->total + 20;

strcpy(p[x]->education," PhD"f);

q[x]->total= q[x]->total + q[x]->test[y];

q[x]->percentage = (q[x]->total/250f) 100;

Display: ID Name Education Test 1 Test 2 Total Marks Percentage

Display:

Best staf to hire Staf Name Staf ID Education

(12)

Chapter 4: Project Implementation

Selection

Selection is used for enter education leiel

if (p[x]->edu==1f) {

q[x]->total= q[x]->total + 10; strcpy(p[x]->education,"SPM "f); }

else if (p[x]->edu==2f) {

q[x]->total= q[x]->total + 20; strcpy(p[x]->education,"Diploma"f); }

else if (p[x]->edu==3f) {

q[x]->total= q[x]->total + 30; strcpy(p[x]->education,"Degree"f); }

else if (p[x]->edu==4f) {

q[x]->total= q[x]->total + 40; strcpy(p[x]->education,"Master"f); }

else if (p[x]->edu==5f) {

q[x]->total= q[x]->total + 50; strcpy(p[x]->education,"PhD "f);

Looping

Looping is used for enter many diferent number of staf oith diferent education

for(x=0; x<siie; x++f) {

cout<<"Enter Staf ID:"; cin>>p[x]->staff_ic;

cout<<"Enter Staf Name:"; cin>>os;

cin.getline(p[x]->name, 100f);

cout<<"Enter Staf Education:"<<endl;

(13)

cin>>p[x]->edu;

cout<<"Enter marks from interiieo - Test 1 & Test 2:"; for(y=0; y<2; y++f)

{

cin>>q[x]->test[y]; }

cout<<endl; clrscr(f); }

Function

Function is used to seperate task for diferent task in the program such as input function, calculate function and display function.

ioid Calcf_TotalMarks(Marks q[], int siief) //to calculate total marks for 2 test {

int x, y;

for(x=0; x<siie; x++f) { q[x]->total = 0.0;

for(y=0; y<2; y++f) {

q[x]->total= q[x]->total + q[x]->test[y]; }

} }

Array

Array is used to manipulate data in list and table

for(x=0; x<siie; x++f) {

p[x] = &s[x]; q[x] = &m[x]; }

Struct

(14)

struct Marks {

float test[2]; float total; int percentage; };

Pointer

Pointer is used to refer to a memory address

ioid main(f) {

Staf s[siie]; Staf p[siie]; int x;

Marks m[siie]; Marks q[siie];

cout<<"Staf Registration -selecting best staf to hire-\n" << endl;

for(x=0; x<siie; x++f) {

p[x] = &s[x]; q[x] = &m[x]; }

Input(p, q, siief);

Calcf_TotalMarks(q, siief);

File Processing

To saie the output in txt format for future used

ofstream outfle;

outfle.open("C:\\hire.txt"f);

int x, y;

outfle<<"ID"<<"\t"<<"Name"<<"\t"<<"Education"<<"\t"<<"Test 1"<<"\t"<<"Test 2"<<"\t"<<"Total Marks"<<"\t"<<"Percentage"<<endl;

outfle<<"========================================== ==========================="<<endl;

for(x=0; x<siie; x++f) {

(15)

for(y=0; y<2; y++f) {

outfle<<q[x]->test[y]<<"\t"<<" "; }

outfle<<q[x]->total<<"\t"<<"\t"<<q[x]->percentage<<"%"; outfle<<endl;

}

outfle<<endl;

outfle<<"Best staf to hire:"<<endl;

outfle<<"==================="<<endl; outfle<<"Staf Name:"<<name<<endl;

outfle<<"Staf ID:"<<ID<<endl;

outfle<<"Education:"<<education<<endl;

(16)
(17)
(18)
(19)

Sample Coding

struct Staf {

int staff_ic; char name[100]; int edu;

char education[100];

};

struct Marks {

float test[2]; float total; int percentage; };

ioid Input(Staf [], Marks [], intf); ioid Calcf_TotalMarks(Marks [], intf); ioid Display(Staf [], Marks [], intf); ioid Percent(Marks [], intf);

ioid Highestf_Mark(Staf [], Marks [], intf); ioid Writef_File(Staf [], Marks [], intf);

float highest = 0.0; char name[100]; int ID;

char education[100];

ioid main(f) {

Staf s[siie]; Staf p[siie]; int x;

Marks m[siie]; Marks q[siie];

cout<<"Staf Registration -selecting best staf to hire-\n" << endl;

for(x=0; x<siie; x++f) {

(20)

q[x] = &m[x]; }

Input(p, q, siief);

Calcf_TotalMarks(q, siief);

//to add extra marks for education leiel for(x=0;x<siie;x++f)

{

if (p[x]->edu==1f) {

q[x]->total= q[x]->total + 10; strcpy(p[x]->education,"SPM "f); }

else if (p[x]->edu==2f) {

q[x]->total= q[x]->total + 20; strcpy(p[x]->education,"Diploma"f); }

else if (p[x]->edu==3f) {

q[x]->total= q[x]->total + 30; strcpy(p[x]->education,"Degree"f); }

else if (p[x]->edu==4f) {

q[x]->total= q[x]->total + 40; strcpy(p[x]->education,"Master"f); }

else if (p[x]->edu==5f) {

q[x]->total= q[x]->total + 50; strcpy(p[x]->education,"PhD "f); }

}

Percent(q, siief); Display(p, q, siief);

Highestf_Mark(p, q, siief); Writef_File(p, q, siief);

cout<<endl;

}

ioid Input(Staf p[], Marks q[], int siief) //input staf registration detail {

int x, y;

for(x=0; x<siie; x++f) {

cout<<"Enter Staf ID:"; cin>>p[x]->staff_ic;

(21)

cin>>os;

cin.getline(p[x]->name, 100f);

cout<<"Enter Staf Education:"<<endl;

cout<<"(SPM:1,Diploma:2,Degree:3,Master:4,PhD:5:"; cin>>p[x]->edu;

cout<<"Enter marks from interiieo - Test 1 & Test 2:"; for(y=0; y<2; y++f)

{

ioid Calcf_TotalMarks(Marks q[], int siief) //calculate total marks for test {

int x, y;

for(x=0; x<siie; x++f) { q[x]->total = 0.0;

for(y=0; y<2; y++f) {

q[x]->total= q[x]->total + q[x]->test[y]; }

}

}

ioid Display(Staf p[], Marks q[], int siief)//to display all staf details {

int x, y;

cout<<"ID"<<"\t"<<"Name"<<"\t"<<"Education"<<"\t"<<"Test 1"<<"\ t"<<"Test 2"<<"\t"<<"Total Marks"<<"\t"<<"Percentage"<<endl;

cout<<"============================================ ========================="<<endl;

for(x=0; x<siie; x++f) {

cout<<p[x]->staff_ic<<"\t"<<" "; cout<<p[x]->name<<"\t"<<" "; cout<<p[x]->education<<"\t"<<" "; for(y=0; y<2; y++f)

{

cout<<q[x]->test[y]<<"\t"<<" "; }

cout<<q[x]->total<<"\t"<<"\t"<<q[x]->percentage<<"%"; cout<<endl;

(22)

ioid Highestf_Mark(Staf p[], Marks q[], int siief)//fnd highest staf marks {

int x;

for(x=0; x<siie; x++f) {

if(q[x]->total> highestf) {

highest = q[x]->total; strcpy(name, p[x]->namef); ID = p[x]->staff_ic;

strcpy(education, p[x]->educationf); }

}

cout<<endl;

cout<<"Best staf to hire:"<<endl;

cout<<"==================="<<endl; cout<<"Staf Name:"<<name<<endl;

cout<<"Staf ID:"<<ID<<endl;

cout<<"Education:"<<education<<endl;

}

ioid Percent(Marks q[], int siief)//calculate staf marks percentage {

int x;

for(x=0; x<siie; x++f) {

q[x]->percentage = (q[x]->total/250f) 100; }

}

ioid Writef_File(Staf p[], Marks q[], int siief)//to saie in txt format {

ofstream outfle;

outfle.open("C:\\hire.txt"f);

int x, y;

outfle<<"ID"<<"\t"<<"Name"<<"\t"<<"Education"<<"\t"<<"Test 1"<<"\t"<<"Test 2"<<"\t"<<"Total Marks"<<"\t"<<"Percentage"<<endl;

outfle<<"========================================== ==========================="<<endl;

for(x=0; x<siie; x++f) {

(23)

{

outfle<<q[x]->test[y]<<"\t"<<" "; }

outfle<<q[x]->total<<"\t"<<"\t"<<q[x]->percentage<<"%"; outfle<<endl;

}

outfle<<endl;

outfle<<"Best staf to hire:"<<endl;

outfle<<"==================="<<endl; outfle<<"Staf Name:"<<name<<endl;

outfle<<"Staf ID:"<<ID<<endl;

outfle<<"Education:"<<education<<endl;

outfle.close(f);

Referensi

Dokumen terkait

Semua orang di atas kereta berlari bersama ke salah satu ujung kereta dengan laju relatif terhadap kereta v r dan kemudian melompat turun bersama-sama?.

Berdasarkan perhitungan dan beberapa asumsi dalam penelitian ini didapatkan bahwa karang menyerap CO2 dalam bentuk ion bikarbonat (HCO;) dari kolom air sebesar 9,991 gr HCO;

Sekolah Tinggi Ilmu Ekonomi Adhi Unggul Bhirawa Surakarta (STIE

Dinamika yang terjadi pada komponen organisme planktonik, akan sangat menentukan apakah organisme planktonik ini dapat menjadi sumber daya makanan yang sesuai dengan

Dari hasil observasi siklus I pertemuan I diketahui dari 13 siswa yang bertanya apabila kurang paham sebesar 69%, siswa yang bekerja sama dengan anggota kelompok sebesar

INTEGRASI SWOT KUANTITATIF DAN KUALITATIF UNTUK MENYUSUN PERENCANAAN STRATEGIS BIDANG PENDIDIKAN (Studi Kasus di Eks-Jurusan Pendidikan Matematika dan Ilmu Pengetahuan Alam

[r]

Catatan : Agar membawa dokumen perusahaan asli sesuai dalam isian kualifikasi serta menyerahkan rekaman/copy-nyaM. Demikian undangan dari kami dan atas perhatiannya