Project Report: Object-Oriented Programming)
Project Report: Object-Oriented Programming)
Project Report: Object-Oriented Programming)
1. Introduction:
2. Objective:
To create Student Database Management System program
To store the record of students
To store calculate the total marks of students
To show the results of the student
3. Requirements:
Abstraction [use of ADT classes] ,
Encapsulation,
Inheritance,
Polymorphism,
Type conversion,
Operator Overloading,
File handling to store data permanently
4. Background Theory
1. Object: Objects are the basic run time entities in an object-oriented system.
2. Class: A class is a user-defined data type that we can use in our program, and it works
as an object constructor, or a "blueprint" for creating objects.
3. Constructor: The constructor can be defined as a class in the same way as that of
normal member functions and can access any of its data members.
4. Encapsulation: This makes the program structure easier to manage because each
object’s implementation and state are hidden behind well-defined boundaries.
5. Polymorphism: This means abstract entities are implemented in multiple ways
according to the message passed.
6. Inheritance: This refers to the hierarchical arrangement of implementation fragments.
7. Type conversion: C++ allows us to convert data of one type to that of another. This is
known as type conversion.
There are two types of type conversion in C++.
a. Implicit Conversion
b. Explicit Conversion (also known as Type Casting)
8. Overloading: If we create two or more members having the same name but different
in number or type of parameter, it is known as C++ overloading.
9. Types of overloading in C++ are:
a. Function overloading
b. Operator overloading
5. Coding:
/***************************************************
****************************************************
*/
#include<iostream>
#include<fstream>
#include<iomanip>
#include<string.h>
class Student_Management
private:
//Class members
char name[10];
int IDnum;
int oop;
int IT;
int multimedia;
int math;
double percentage;
char grade;
public:
// Class functions
void getdata();
void total();
void student_record();
void display_record(int);
void Search_display(int);
void modify_record(int);
void delete_record(int);
void display_result();
};
void Student_Management::getdata()
cin.getline(name,10);
cin>>oop;
cin>>IT;
cin>>multimedia;
cin>>math;
total();
void Student_Management::total()
percentage=(oop+IT+multimedia+math)/4;
if (percentage>=80)
grade='A';
}
else if (percentage>=60)
grade='B';
else if (percentage>=40)
grade='C';
else
grade='F';
else
grade='F';
{
cout<<"\nName:"<<name<<endl;
cout<<"ID number:"<<IDnum<<endl;
cout<<"OOP mark:"<<oop<<endl;
cout<<"IT mark:"<<IT<<endl;
cout<<"Multimedia mark:"<<multimedia<<endl;
cout<<"Math mark:"<<math<<endl;
cout<<"Percentage:"<<percentage<<endl;
cout<<"Grade:"<<grade<<endl;
cout<<IDnum<<setw(5)<<"
"<<name<<setw(10)<<oop<<setw(11)<<IT<<setw(15)<<multimedia<<setw(21)<<math<<s
etw(18)<<percentage
<<setw(7)<<grade<<endl<<endl;
return IDnum;
}
void student_record()
outFile.open("Student_record.txt",ios::binary|ios::app);
S.getdata();
outFile.close();
void display_record()
inFile.open("Student_record.txt",ios::in);
if (!inFile)
return;
S.showdata();
inFile.close();
cin.ignore();
cin.get();
void display_search(int n)
Student_Management S;
if(!inFile)
cin.ignore();
cin.get();
return;
if(S.getIDnum()==n);
S.showdata();
flag = true;
inFile.close();
if (flag==false)
void modify_record(int n)
bool flag=false;
Student_Management S;
fstream File; //Stream class to both read and write from/to files
File.open("Student_record.txt",ios::in);
if(!File)
cin.ignore();
cin.get();
return;
if ( S.getIDnum()==n)
S.showdata();
cout<<"\n\n Please enter the new details of student"<<endl;
S.getdata();
int pos=(-1)*static_cast<int>(sizeof(S));
File.seekp(pos,ios::cur);
flag=true;
File.close();
if(flag==false)
void delete_record(int n)
Student_Management S;
ifstream inFile;
inFile.open("Student_record.txt");
if(!inFile)
cout<<"\n Sorry !!! File could not be open.Please press any key to
continue........ " ;
return;
ofstream outFile;
inFile.open("delete.txt",ios::out);
inFile.seekg(0,ios::beg);
if(S.getIDnum() != n)
outFile.close();
inFile.close();
remove("Student_record.txt");
rename("delete.txt","Student_record.txt");
void display_result()
Student_Management S;
ifstream inFile;
inFile.open("Student_record.txt",ios::in);
if(!inFile)
cout<<"Sorry !!! File could not be open.Please press any key to continue........"
;
cin.ignore();
cin.get();
return;
cout<<"============================================================
=========================="<<endl;
cout<<"\t\t\t **REULTS OF STUDENTS** "<<endl;
cout<<"============================================================
=========================="<<endl;
cout<<"============================================================
=========================================="<<endl;
S.showheader();
inFile.close();
// Main function
int main()
int ch;
int n;
cout.setf(ios::fixed | ios::showpoint);
cout<<setprecision(2);
do
cout<<"=========================================================="<<
endl;
cout<<"=========================================================="<<
endl;
cout<<" 7. EXIT\n"<<endl;
cin>>ch;
switch(ch)
case 1:
student_record();
break;
case 2:
display_record();
break;
case 3:
cin>>n;
display_search(n);
break;
case 4:
cin>>n;
modify_record(n);
break;
case 5:
cin>>n;
delete_record(n);
break;
case 6:
display_result();
break;
case 7:
exit(0);
default:
while(ch != '7');
return 0;
6. Output
7.UML DIAGRAM
8. Conclusion: After the completion of this project provided by my teacher Sukant Kumar
Sahu I became familiar with the different concepts of OOP (Object oriented programming) .I
also have build up the confidence to make different program in C++ by using the concepts of
it. So, I would like to thank my teacher for giving me this project.
9. References:
1. Notes
2. Final report