40
STUDENT RESULT SYSTEM B.Tech. Project Report for PBL course Course: Design and Analysis of Algorithm (CSE-311) Submitted by KUMAR ANAND-14SCSE101249 MD TARIQUL AZAM-14SCE101224 Under the supervision of SANDEEP KAUR (ASSISTANT PROFESSOR) SCHOOL OF COMPUTING SCIENCE AND ENGINEERING 1

Project for Student Result System

Embed Size (px)

Citation preview

Page 1: Project for Student Result System

STUDENT RESULT SYSTEM

B.Tech. Project Report for PBL courseCourse: Design and Analysis of Algorithm

(CSE-311)

Submitted by KUMAR ANAND-14SCSE101249

MD TARIQUL AZAM-14SCE101224

Under the supervision ofSANDEEP KAUR

(ASSISTANT PROFESSOR)

SCHOOL OF COMPUTING SCIENCE AND ENGINEERING

GALGOTIAS UNIVERSITY

GREATER NOIDA, GAUTAM BUDDH NAGAR,

UTTAR PRADESH, INDIA

November 2016

1

Page 2: Project for Student Result System

Certificate

I hereby certify that the work which is being presented in the Project Based Learning (PBL)

entitled, “STUDENT RESULT SYSTEM”, in partial fulfillment of the requirements for the

award of degree of Bachelor in Technology in Computer Science and Engineering submitted in

School of Computing Science and Engineering of Galgotias University, Gr. Noida, is an

authentic record of my own work carried out under the supervision of Ms. SANDEEP KAUR

and refers other researcher’s works which are duly listed in the reference section.

The matter presented in this project has not been submitted for the award of any other degree of

this or any other university.

(Kumar Anand) (Md Tariqul Azam)

This is to certify that the above statement made by the candidate is correct and true to the best of

my knowledge.

( Ms. Sandeep Kaur) Assistant Professor

School of Computing Science and EngineeringGalgotias University

Gr. Noida, India-201306

2

Page 3: Project for Student Result System

Acknowledgement

I would like to take this opportunity to express my profound sense of gratitude and respect to all

those who helped me throughout the duration of this project. GALGOTIAS UNIVERSITY in

particular has been the source of inspiration for me.

I acknowledge the effort of those who have contributed significantly to my project.

I feel privileged to offer my sincere thanks and deep sense of gratitude to supervision of Ms.

Sandeep Kaur as project guide, for expressing his confidence in me by letting me work on a

project of this magnitude and using the latest technologies and providing his support, help &

encouragement in implementing this Project. I would also like to thank Dr. Parmanand,

Professor and Dean, School of Computing Science & Engineering for providing me opportunity

to work on this project.

3

Page 4: Project for Student Result System

CONTENTS

List of Figures S.NO. Title Page No.1. UML DIAGRAM 112. OUTPUT (MAIN MENU) 273. INSERTION 284. DISPLAY 295. AVERAGE 306. SORTING 31

4

Page 5: Project for Student Result System

1. INTRODUCTION

1.1 MOTIVATION

In computer science, a Design and Analysis of Algorithm is a particular way of organizing data in a computer so that it can be used efficiently. It can implement on or more particular Abstract Data Types (ADT), which are the means of specifying the contract of operations and their complexity. In comparison, it is a concrete implementation of the contract provided by an ADT.

Data structures provide a means to manage large amounts of data efficiently for uses such as large databases and internet indexing services. Usually, efficient data structures are key to designing efficient algorithms. Some formal design methods and programming languages emphasize data structures, rather than algorithms, as the key organizing factor in software design. Storing and retrieving can be carried out on data stored in both main memory and secondary memory.

The implementation of a data structures usually requires writing a set of procedures that create and manipulate instances of that structure. The efficiency of data structure cannot be analyzed separately from those operations. This observation motivates the theoretical concept of abstract data type, a data structure that is defined indirectly by the operations that may be performed on it, and mathematical properties of those operations (including their space and time cost).

1.2 Problem Definition

To create a Student Result System using ‘C’ Language involving concepts of Searching and Sorting and its analysis.

This software will contain all the necessary information regarding student’s record.

5

Page 6: Project for Student Result System

1.3 Objective of Project

The objective of the project is to create a Student Result System to store the Name, Roll no., Marks of different student using a linear data structure using C programming.

In this software one can very easily add student’s record, sort student’s record, search student’s record, compute (using algorithms) and view all student’s records. This application stand out among all other software in a way that it is user friendly and can be modified easily as per the requirements. It allows user to add new/view/sort/search records.

6

Page 7: Project for Student Result System

2. LITERATURE SURVEY

2.1 EXISTING SYSYTEM/ALGORITHM

The Student Database System is the software that enables user to easily store and find record’s information such as name, roll no and marks. There are record-centric databases (database.txt and record.txt) that provide a fully integrated approach to store information from user and communicate with the software.

2.2 DISADVANTAGE OF EXISTING SYSTEM/ALGORITHM

The main disadvantage of this software is that it is OS dependent since it is made in C programming language. It is not portable like other languages like JAVA whose software can run on any operating system.

Also, it is console based software so we cannot use attractive features which are used in window, web or mobile application.

The use of linear search in file handling might increase the time complexity.

7

Page 8: Project for Student Result System

2.3 PROPOSED APPROACH AND ITS JUSTIFICATION

The Student Database System may be chosen because it is thought to provide following advantages: -

1. This software is space and time efficient.2. It is small and user friendly.3. Document Management.4. File Handling is effectively implemented.5. Attractive design.

8

Page 9: Project for Student Result System

ANALYSIS

3.1 SOFTWARE REQUIREMENT SPECIFICATION

3.1.1 USER REQUIREMENT

The Turbo C++/Dev C software should be successfully installed on user’s system.

3.1.2 SOFTWARE REQUIREMENTS

To successfully operate this software, one requires

*Windows XP/VISTA/7/8/8.1/10

*Memory Space: Minimum 250 Mb

*RAM: Minimum 256 Mb

*Processor: Pentium 1, Pentium 2, Celeron, Intel core 2 duos

*Compiler: Turbo C3

3.1.3 HARDWARE REQIUREMENTS

*High resolution screen

*Keyboard

*Mouse

*Printer

3.3 ALGORITHM AND FLOWCHARTS

9

Page 10: Project for Student Result System

The algorithm used for sorting in the software is Merge sort. It divides the list of records into two equal lists and so on. After that, the sub lists are joined in the sorted manner and the final sorted list is obtained.

The Merge sort has complexity of n(logn) for all the cases. So, it requires same time to execute irrespective of the position and value of elements.

The linear search is also used along with file handling which looks for the record in the list provided by user and then performs the operation according to the requirement.

The concept of linear search is used in insertion and searching effectively.

DESIGN

4.1 INTRODUCTION

A Student Result System is usually used in schools/colleges for storing records of students. All student information can be stored and different operations can be performed on it through database.

What can on do with Student Result System?Retrieve and send all record and related information from/to database through File Handing.

4.2 UML DIAGRAM

10

Page 11: Project for Student Result System

IMPLEMENTATION AND RESULTS11

Page 12: Project for Student Result System

5.1 EXPLANATION OF KEY FUNCTION

Student Result System is simple small software in C. It is similar to actual database of records. It performs Insertion, Searching, Sorting and other operations on records.

The merge sort technique has been used for sorting marks and roll number. The linear search is along file handling for searching and insertion.

5.2METHOD OF IMPLEMENTATION

5.2.1 SOURCE CODE

#include<stdio.h>

#include<conio.h>

#include<fstream.h>

#include<stdlib.h>

#include<string.h>

void insertion();

void display();

void sorting_marks();

void sorting_roll();

void mergesort(int *,int,int);

void merge(int *,int ,int ,int,int);

void search();

void avmarks();

int marks[100],rollno[100],i,j,arr[100],n;

char name[100][50];

12

Page 13: Project for Student Result System

FILE *fd,*fr,*d;

void main()

{

main:

int ch;

while(1)

{

clrscr();

printf("\n\t\t***** STUDENT DATABASE SYSTEM *****");

printf("\n\t\t**********MADE BY:*******\n\t\tMD TARIQUL AZAM(14SCSE101224)\n\t\t KUMAR ANAND(14SCSE101249)\n");

printf("\n\n\n\t\t\tMAIN MENU\n\t\t=====================");

printf("\n\t\t[1] ADD STUDENT RECORD");

printf("\n\t\t[2] VIEW DATABASE ENTRIES");

printf("\n\t\t[3] SEARCH RECORD BY ROLL NO");

printf("\n\t\t[4] AVERAGE STUDENTS MARKS");

printf("\n\t\t[5] SORT FILE ON MARKS BASIS");

printf("\n\t\t[6] SORT FILE ON ROLL NO BASIS");

printf("\n\t\t[7] Delete Record");

printf("\n\t\t[8] EXIT\n\t\t=================\n\t\t");

printf("PLEASE ENTER YOUR CHOICE:");

scanf("%d",&ch);

switch(ch)13

Page 14: Project for Student Result System

{

case 1: insertion();

break;

case 2: display();

break;

case 3: search();

break;

case 4: avmarks();

break;

case 5: sorting_marks();

break;

case 6: sorting_roll();

break;

case 7: printf("\n\n\t\tARE YOU SURE YOU WANT TO EXIT?");

break;

default: printf("OOPS WRONG CHOICE!!! ENTER CHOICE AGAIN\n");

}

14

Page 15: Project for Student Result System

printf("\n\n\n\t\tENTER THE CHOICE:");

printf("\n\n\t\t[0] MAIN MENU\t\t[7] EXIT\n");

scanf("%d",&ch);

switch (ch)

{

case 0:

goto main;

case 7:

exit(1);

default:

printf("\nINVALID CHOICE");

break;

}

}

}

void insertion() //INSERTION IN DATABASE

{ long int mark;

long int roll,a;

char name[50],n[50];

int flag=0;

clrscr();

15

Page 16: Project for Student Result System

printf("\n===============\nInsertion in Databse\n================\n");

fd=fopen("database.txt","r");

printf("\n\nENTER NAME:");

scanf("%s",name);

printf("Enter Enrollment no.:");

scanf("%ld",&roll);

printf("Enter the marks:");

scanf("%ld",&mark);

strcpy(n,name);

a=roll;

while(!feof(fd))

{

fscanf(fd,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);

if(a==rollno[i])

{

printf("\nRecord is already Present\n\t");

flag=1;

}

else

{

do

{

if(mark>500)

{

printf("\n\tTotal Marks should not be greater than 500\n\t");

16

Page 17: Project for Student Result System

scanf("%ld",&mark);

}

}while(mark>500);

flag=0;

}

i=i+1;

}

fclose(fd);

if(flag==0)

{

d=fopen("database.txt","a");

fprintf(d,"%s %ld %ld \n",n,roll,mark);

fclose(d);

}

}

void display() //VIEWING DATABASE RECORDS

{

clrscr();

fd=fopen("database.txt","r");

i=0;

printf("\n\t\t================================");

17

Page 18: Project for Student Result System

printf("\n\t\t LIST OF INSERTED RECORDS");

printf("\n\t\t================================\n\n");

printf("\n------------------------\nNAME ROLL NO MARKS\n------------------------\n");

while(!feof(fd))

{

fscanf(fd,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);

printf("%s %d %d\n",name[i],rollno[i],marks[i]);

i=i+1;

}

fclose(fd);

printf("\n\n*****PRESS ANY KEY*****");

getch();

}

void sorting_marks() //SORTING RECORDS(BUBBLE SORT)

{

clrscr();

fd=fopen("database.txt","r");

fr=fopen("record.txt","w");

i=0;

while(!feof(fd))

{

fscanf(fd,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);18

Page 19: Project for Student Result System

arr[i]=marks[i];

i=i+1;

}

n=i;

mergesort(arr,0,n-1);

//printf("\n\n****SORTED RECORDS(MARKS BASIS)****\n\n");

//for(i=0; i<n; i++)

//printf("%s %d %d \n",name[i],rollno[i],arr[i],"\n");

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

if(arr[i]==marks[j])

fprintf(fr,"%s %d %d \n",name[j],rollno[j],marks[j],"\n");

}

}

fclose(fd);

fclose(fr);

fr=fopen("record.txt","r");

i=0;

printf("\n\n****SORTED RECORDS(MARKS BASIS)****\n\n");

while(!feof(fr))

19

Page 20: Project for Student Result System

{

fscanf(fd,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);

printf("%s %d %d\n",name[i],rollno[i],marks[i]);

i=i+1;

}

fclose(fr);

printf("\n\n*****PRESS ANY KEY*****");

getch();

}

void sorting_roll()

{

clrscr();

fd=fopen("database.txt","r");

fr=fopen("record.txt","w");

i=0;

while(!feof(fd))

{

fscanf(fd,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);

arr[i]=rollno[i];

i=i+1;

}

n=i;

20

Page 21: Project for Student Result System

mergesort(arr,0,n-1);

//printf("\n\n****SORTED RECORD(ROLLNO BASIS)****\n\n");

//for(i=0; i<n; i++)

//printf("%s %d %d \n",name[i],arr[i],marks[i],"\n");

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

if(arr[i]==rollno[j])

fprintf(fr,"%s %d %d \n",name[j],rollno[j],marks[j],"\n");

}

}

fclose(fd);

fclose(fr);

fr=fopen("record.txt","r");

i=0;

printf("\n\n****SORTED RECORDS(ROLLNO BASIS)****\n\n");

while(!feof(fr))

{

fscanf(fd,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);

printf("%s %d %d\n",name[i],rollno[i],marks[i]);

i=i+1;

21

Page 22: Project for Student Result System

}

fclose(fr);

printf("\n\n*****PRESS ANY KEY*****");

getch();

}

void mergesort(int a[],int i,int j)

{

int mid;

if(i<j)

{

mid=(i+j)/2;

mergesort(a,i,mid); //left recursion

mergesort(a,mid+1,j); //right recursion

merge(a,i,mid,mid+1,j); //merging of two sorted sub-arrays

}

}

void merge(int a[],int i1,int j1,int i2,int j2)

{

int temp[50]; //array used for merging

int i,j,k;

i=i1; //beginning of the first list

j=i2; //beginning of the second list22

Page 23: Project for Student Result System

k=0;

while(i<=j1 && j<=j2) //while elements in both lists

{

if(a[i]<a[j])

temp[k++]=a[i++];

else

temp[k++]=a[j++];

}

while(i<=j1) //copy remaining elements of the first list

temp[k++]=a[i++];

while(j<=j2) //copy remaining elements of the second list

temp[k++]=a[j++];

//Transfer elements from temp[] back to a[]

for(i=i1,j=0;i<=j2;i++,j++)

a[i]=temp[j];

}

void search() //SEARCHING RECORD BY ROLL NO

{

int i,roll,ch,mark,rollno;

char name[50];

23

Page 24: Project for Student Result System

clrscr();

fd=fopen("database.txt","r");

printf("\n\t\t=========================");

printf("\n\t\t SEARCHING RECORDS");

printf("\n\t\t=========================\n\n");

printf("\n\n******ENTER ROLL NUMBER:");

scanf("%d",&rollno);

i=0;

while(!feof(fd))

{

fscanf(fd,"%s %d %d\n",&name,&roll,&mark);

if(rollno==roll)

{

printf("\nNAME ROLLNO MARKS\n");

printf("%s %d %d\n",name,roll,mark);

break;

}

else

i=i+1;

}

fclose(fd);

printf("\n\n*****PRESS ANY KEY*****");

getch();

}

24

Page 25: Project for Student Result System

void avmarks() //CALCULATING AVERAGE MARKS OF ALL STUDENTS

{

int ma=0,n,i,x=0;

float avg;

clrscr();

printf("\n\t\t================================");

printf("\n\t\t AVERAGE MARKS OF STUDENTS");

printf("\n\t\t================================\n\n");

fr=fopen("database.txt","r");

i=0;

while(!feof(fr))

{

fscanf(fr,"%s %d %d\n",&name[i],&rollno[i],&marks[i]);

x=x+marks[i];

arr[i]=marks[i];

i=i+1;

}

n=i;

avg=x/n;

printf("\nAVERAGE MARKS OF %d STUDENTS ARE:%f",n,avg);

for(i=0;i<n;i++)

{

25

Page 26: Project for Student Result System

if(ma<arr[i])

{

ma=arr[i];

}

}

printf("\n\tMaximum Marks:-%d",ma);

fclose(fr);

printf("\n\n*****PRESS ANY KEY*****");

getch();

}

5.2.2 OUTPUT

26

Page 27: Project for Student Result System

MAIN MENU

27

Page 28: Project for Student Result System

INSERTION

DISPLAY

28

Page 29: Project for Student Result System

AVERAGE AND MAXIMUM

29

Page 30: Project for Student Result System

SORTING (ROLL NUMBER BASIS)

30

Page 31: Project for Student Result System

SORTING (ON MARKS BASIS)

TESTING AND VALIDATION

31

Page 32: Project for Student Result System

ERRORS AND VALIDATION

Apart from some syntax errors, there were some errors in the program like user may enter any amount of marks. But total subjects is 5, so maximum marks must be <= 500.

Also user may enter records of students who are already present.It will take duplicate values.

So, we have eliminated all these problem which makes it an effective software.

CONCLUSION

The projects clearly depicts that the Student Result System is very efficient. It shows how the concept of File Handing can be used in database management system in absence of databases like Oracle, MySql etc.

Although, this software can be further modified to be used as multitasking and bigger software, but it effectively works under the condition of limited resources and time.

32

Page 33: Project for Student Result System

REFERENCE

1. Let Us C- Yashavant P Kanetkar2. Data Structure Through C In Depth- S.K. Srivastava3. https:/www.w3schools.in/c-tutorial/file-handling4. https:/www.tutorialpoint.com/cprogramming5. https:/en.m.wikipedia.org/

33