Student DATABASE MANAGeMEnT SysTEm

Preview:

DESCRIPTION

ComPUter ScienCE///

Citation preview

Name: ArjunN.M

Class : XII-B

Investigatory Project

Certificate Kendriya Vidyalaya Payyannur

Certified that this is the

bonafide record of the

investigatory project done in

computer science on

“STUDENT INFORMATION SYSTEM“

By Of class

for the academic year 2014-15.

Teacher in charge Head of the

Institution

External Examiner

Acknowledgement I hereby express my sincere thanks and

gratitude to our computer science

teacher Mrs.Reena.P.V for her support

and gratitude. I also thank CBSE for

providing me such an opportunity.

I am extremely grateful and thankful to

both my parents and friends for their

constructive criticism and valuable

suggestions extended to me throughout

this project.

Thank you,

Object Oriented

Programming

A type of programming in which programmers

define not only the data type of data structure ,

but also the types of operations (functions) that

can be applies to the data structure.

In this way, the data structure becomes an

object that includes both data and functions.

Objectives Of OOP The programming in which data is logically

represented in the form of a class and physically

represented in the form of an object is called as

object oriented programming (OOP).OOP has the

following important features.

CLASS :- In OOP languages it is must to create a

class for representing data. Class contains

variables for storing data and functions to

specify various operations that can be performed

on data. Class will not occupy any memory space

and hence it is only logical representation of data.

OBJECTS :- Objects are the basic building block

of OOP system. The real world objects have two

characteristics: state and behavior. All the

objects in OOPS are based on real world having a

specific state and behavior.

Characteristics Of

Object Oriented

Programming

1. Data Abstraction

2. Data Encapsulation

3. Data Hiding

4. Polymorphism

5. Inheritance

6. Modularity 1. Data Abstraction

Abstraction refers to the act of representing

essential features without including the

background details.

2. Data Encapsulation

Encapsulation is the process of combining

data and function into a single unit called

class. Using the method of encapsulation,the

programmer cannot directly access the data.

Data is only accessible through the functions

existing inside the class.

3. Data Hiding

Data hiding is the implementation details of a

class that are hidden from the user. A class

groups its members into three sections.

4. Polymorphism

It is the property by which a message can be

sent to the objects of different classes and

each object will respond in different way.

5. Inheritance

It has the property of a class to inherit

properties from other class.

6. Modularity

The act of partitioning a program into

individual components is called modularity.

Project Details This is a project based on

“STUDENT INFORMATION SYSTEM”

Header Files Used:-

1. FSTREAM.H- for file handling,

cin and cout.

2. PROCESS.H-for exit( ) function

3. CONIO.H-for clrscr( ) & getch()

function

4. STDIO.H-for standard I/O

operations

5. STRING.H-for string handling

CODING #include<iostream.h>

#include<conio.h>

#inlcude<process.h>

#include<stdio.h>

#include<string.h>

class student

{

int admno[5];

char name[40];

float marks;

char grade;

char dob[10];

int rno;

char fathername[20];

char mothername[20];

int phone[10];

char remarks[50];

public :

void getdata( )

{

cout<<”Enter the details “;

cout<<” \n Enter your name ……\n”;

gets(name);

cout<<”\n Enter your roll number…\t”;

cin>>rno;

cout<<”\n Enter your admission number … \t”;

cin>>admno;

cout<<”\n Enter your father’s name…\t”;

cin>>fathername;

cout<<”\n Enter your mother’s name…\t”;

cin>>mothername;

cout<<”\n Enter your Date of birth

(DD/MM/YY)…”;

gets(dob);

cout<<”\n Enter your phone number…\t”;

cin>>phone;

cout<<”\n Enter the total marks……\t”;

cin>>marks;

getgrade( );

giveremarks( );

}

void getgrade( )

{

if(marks>=90)

grade=’A+’;

else if(marks<90 && marks>=80)

grade=’A’;

else if(marks<80 && marks>=70)

grade=’B’;

else if(marks<70 && marks>=60)

grade=’C’;

else if(marks<60 && marks>=50)

grade=’D’;

else

grade=’E’;

}

void giveremarks( )

{

if(grade==’A’)

strcpy(remarks, “ Excellent “);

else if(grade==’B’)

strcpy(remarks,”Very good! keep it up!”)

else if(grade==’C’)

strcpy(remarks,”Can do better ! “);

else if(grade==’D’)

strcpy(remarks,”try to score more !”)

else

strcpy(remarks,”Hard work required”)

}

void putdata( )

{

cout<<” ~~~The Student Details Are~~~”;

cout<<”\n Name :- \t”;

puts(name);

cout<<”\n Admission number :- \t”;

cout<<admno;

cout<<”\n Roll no:- \t”;

cout<<rno;

cout<<”\n Date Of Birth :- \t”;

puts(dob);

cout<<”\n Father’s Name :- \t”;

cout<<fathername;

cout<<”\n Mother’s Name :- \t”;

cout<<mothername;

cout<<” \nYour total marks is….\t”;

cout<<marks;

cout<<”\nYou have got ”<<grade<<” grade”;

cout<<”\nRemarks :- “;

puts(remarks);

}

int getroll()

{

return rno;

}

void modify()

{

cout<<” \nEnter the new details”;

cout<<” \n Enter your name ……\n”;

gets(name);

cout<<”\n Enter your roll number…\t”;

cin>>rno;

cout<<”\n Enter your admission number … \t”;

cin>>admno;

cout<<”\n Enter your father’s name…\t”;

cin>>fathername;

cout<<”\n Enter your mother’s name…\t”;

cin>>mothername;

cout<<”\n Enter your Date of birth

(DD/MM/YY)…”;

gets(dob);

cout<<”\n Enter your phone number…\t”;

cin>>phone;

cout<<”\n Enter the total marks……\t”;

cin>>marks;

getgrade( );

giveremarks( );

}

};

void insertdata( )

{

fstream f;

f.open(“Student.dat”,ios::out || ios::binary);

student s;

s.getdata( );

f.write((char *)&s,sizeof(s);

f.close( );

}

void appenddata( )

{

student S;

ofstream f;

f.open(“Student.dat”,ios::app || ios::binary);

char ch=’y’;

while(ch==’y’)

{

S.getdata( );

f.write((char*)&S,sizeof(S));

cout<<”Do you want to continue…?? (y/n)…”;

cin>>ch;

}

f.close( );

}

void deletedata( )

{

int rno;

student s;

cout<<”Enter the Roll number to be deleted..”;

cin>>rno;

fstream f,F;

f.open(“Student.dat”,ios::in || ios::binary);

F.open(“Tmp.dat”,ios::out||ios::binary||ios::in);

while(f)

{

f.read((char*)&s,sizeof(s));

if(s.getroll( )==rno)

{

cout<<” \nThe record is Deleted……”;

}

else

F.write((char*)&s,sizeof(s));

}

int l=remove(“Student.dat”);

int m=rename(“Tmp.dat”,”Student.dat”);

F.seekg(0,ios::beg);

while(f)

{

F.read((char*)&s,sizeof(s));

s.putdata( );

}

f.close( );

F.close( );

}

void Modifydata( )

{

student s;

int rno;

char found =’n’;

cout<<”Enter the roll number of the record to

be modified”;

cin>>rno;

fstream f;

f.open(“Student.dat”,ios::in || ios::app ||

ios::binary);

while(f)

{

f.read((char*)&s,sizeof(s));

if(s.getroll( )==rno)

{

found=’y’;

s.modify( );

f.seekp(-1*sizeof(s),ios::cur);

f.write((char*)&s,sizeof(s));

f.close( );

}

void displaydata( )

{

fstream f;

f.open(“Student.dat”,ios::in || ios::binary);

student s;

f.read((char*)&s,sizeof(s));

s.putdata( );

f.close( );

}

void searchrecord( )

{

student s;

int rno;

char found=’n’;

cout<<”Enter the roll No. of the record to be

searched for……”;

cin>>rno;

fstreamf;

f.open(“Student.dat”,ios::in || ios::out ||

ios::binary);

while(f)

{

f.read((char*)&s,sizeof(s));

if(s.getroll( )==rno);

{

found=’y’;

s.putdata( );

}

else

found=’n’;

}

if(found==’n’)

{

cout<<” Sorry Record not Found…! “;

}

f.close( );

}

void main( )

{

int ch;

cout<<”==========STUDENT DATABASE

MANAGEMENT SYSTEM==========”;

cout<<”\n\n\n 1.Add Record\n\n2.Delete

Record\n\n3.Append Record\n\n4.Modify

Record\n\n5.Display Record\n\n6.Search

Record\n\n6.Exit\n\n”;

cout<<”\n~~ENTER YOUR CHOICE~~\n”;

cin>>ch;

switch(ch)

{

case 1 :insertdata( );

break;

case 2 :deletedata( );

break;

case 3 :appenddata( );

break;

case 4 :modifydata( );

break;

case 5 :displaydata( );

break;

case 6 :searchrecord( );

break;

case 7 :exit(0);

break;

default case: cout<<”Invalid Input….Sorry!”;

}

getch( );

}

Output ==========STUDENT DATABASE MANAGEMENT SYSTEM==========

1.Add Record

2.Delete Record

3.Append Record

4.Modify Record

5.Display Record

6.Search Record

7.Exit

~~ENTER YOUR CHOICE~~

1

Enter the details

Enter your name ……Arjun Nm

Enter your roll number…24

Enter your admission number …4672

Enter your father’s name…KM Govindan

Enter your mother’s name…Usha NM

Enter your Date of birth

(DD/MM/YY)…19/11/97

Enter your phone number…9495479414

Enter the total marks……96

==========STUDENT DATABASE MANAGEMENT SYSTEM==========

1.Add Record

2.Delete Record

3.Append Record

4.Modify Record

5.Display Record

6.Search Record

7.Exit

~~ENTER YOUR CHOICE~~

1

Enter the details

Enter your name ……Aswin Saket

Enter your roll number…28

Enter your admission number …1500

Enter your father’s name…T Shivadasan

Enter your mother’s name…Lalitha Saket

Enter your Date of birth

(DD/MM/YY)…17/07/97

Enter your phone number…4912801083

Enter the total marks……93

==========STUDENT DATABASE MANAGEMENT SYSTEM==========

1.Add Record

2.Delete Record

3.Append Record

4.Modify Record

5.Display Record

6.Search Record

7.Exit

~~ENTER YOUR CHOICE~~

5

~~~The Student Details Are~~~

Name :-Arjun Nm

Admission number :-4672

Roll no:-24

Date Of Birth :-19/11/97

Father’s Name :-K M Govindan

Mother’s Name :-Usha NM

Your total marks is….96

You have got A+ grade”;

Remarks :- Excellent ==========STUDENT DATABASE MANAGEMENT SYSTEM==========

1.Add Record

2.Delete Record

3.Append Record

4.Modify Record

5.Display Record

6.Search Record

7.Exit

~~ENTER YOUR CHOICE~~

2

Enter the roll Number to be deleted…28

The Record deleted…… ==========STUDENT DATABASE MANAGEMENT SYSTEM==========

1.Add Record

2.Delete Record

3.Append Record

4.Modify Record

5.Display Record

6.Search Record

7.Exit

~~ENTER YOUR CHOICE~~

7

Bibilography www.Google.com

www.kvsecontent.com

www.wikipedia.com

www.facebook.com

www.gmail.com

Recommended