Computer Science Investigatory Project (LIBRARY MANAGEMENT SYSTEM) CLASS 12 CBSE
Computer Science Investigatory Project (LIBRARY MANAGEMENT SYSTEM) CLASS 12 CBSE
1. Encapsulation
The wrapping up 0 data and functions (that
operate on the data into single unit (called class) is
known as Encapsulation.
2. Data Abstraction
Abstraction refers to the act of representing
essential features without including the background
detail or explanations.
3. Modularity
Modularity is the property of a system that has
been decomposed into set of cohesive and coupled
modules.
4. Inheritance
Inheritance is the capability 0 one class 0 things to
inherit capabilities or properties from another class.
5. Polymorphism
Polymorphism is the ability for a message or data
to be processed in more than one form. Polymorphism is
a property by which the same message can be sent to
objects of several different classes.
Stream Description
cin Console input
cout Console output
cerr Standard error
clog Buffered version of error
Keywords
A keyword is a reversed word of C++. This cannot be
used as an identifier by the user in his program.
Example of some valid constant declarations is:
1. class
2. private
3. return
4. while
Constants
A symbolic name or identifier which does not change
its value during exception of a program is known as
constant. Constant qualifier can be used to declare
constant as shown below
const float p=3.5
Examples of some valid constants declaration are:
Variables
A variable is an identifier. It is the most fundamental
aspect of any computer language. It is a location in the
computer memory which can store data and is given a
symbolic name for easy reference.
I/O STATEMENTS
Operators
An operator is a symbol or letter used to indicate a
specific operation on variable in a program. For eg '+' is
an addition operator that adds two data items called
operands.
Flow of control
The architecture of a general purpose computer is
von-Neumarn architecture.
Such a computer use serial sequential nature. Therefore
the normal flow of execution of statements in a high
level language is also sequential, i.e. each statement is
executed in the order of its appearance in the program.
Repetitive statements
Some problems require the set of statements should be
executed more than one time, each time changing one or
more variables, so that every execution is different from
the previous one. This kind of repetitive execution of a
set of statements in a program is known as iteration
loop.
1. while loop
2. do while loop
3. for loop
are the iterative statements.
Arrays
An array is a structure with the help of which a
programmer can refer to and perform operations on a
group of similar data items such as simple lists or tables
of information. An array whose elements are specified by
a single subscript is known as single dimensional array.
The array whose elements are specified by two or more
subscripts is known as multi-dimensional array.
Strings
A string is a group of characters of any length. A
string is enclosed within quotation marks as literal for
ego "Hello" is a literal. The strings can be stored and
manipulated as array of characters. The last character is
always '\0' a null character with ASCII value equal to
0.thus, the effective size of an array is more than the
size of string it can hold
C o M P u T E R '\0'
Two dimensional Arrays
A two dimensional array of characters is known as an
array of strings. The row subscripts decide as to how
many strings can be stored in the array and the column
subscript tells the size of each string.
For eg. char d[20][10];
Functions
A subprogram of function is a name given to a set of
instructions that can becalled by another program or a
subprogram.
A function is a complete program in itself in the sense
that its structure is similar to C++main function except
that the name is replaced by the name of the function,
the general form of a function given below:
<type><name>( arguments)
Function prototypes
Similar to variables, all functions must be declared
before they are used in aprogram. C++ allows the
declaration of functions in the calling program with the
help of a function prototype in the calling program is
given below:
<type><name>( arguments)
Functions
Functions are building blocks of the programs. They
make the programs more modular and easy to read and
manage. All C++ programs must contain the function
main(). The execution of the program starts from the
function main(). A C++ program can contain any number
of functions according to the needs.
The general form of the fnction is:
return_type function _ name(parameter list);
{
Body of the function
}
Function Declaration
Function declaration is made by declaring the return
type of the function, e of the function and the data type
of the parameters of the function. A function declaration
is same as the declaration of the variable. The
functiondeclaration is always terminated by the
semicolon. A call to the function cannot be made unless
it is declared.
The general form of the declaration is:
return_typefunction_name (parameter list);
For example:
int factorial (int n, float j);
The variables name need not be same as the variables in
the parameter list of the function.
Another method can be
int factorial (int, float);
Function arguments
The information is transferred to the function by the
means of the arguments when a call to a function is
made. Arguments contain the actual value which is to be
passed to the function when it is called.
The sequence of the arguments in the call of a function
should be same as the sequence of the parameters in the
parameter list of the declaration of the function.
The data types of the arguments should correspond with
the data types of the parameters. When a function call is
made arguments replace the parameters of the function.
return expression;
The statement:
int factorial (int n);
is a declaration of the function. The return type is
integer.
The statements:
cout«"Enter the number whose factorial has to be
calculated"«endl;
cin»n;
make the user enter the number, whose factorial is to be
calculated. The variable n stores the number entered by
the user. The user has entered number 5.
The statement:
fact=factorial(nl );
makes a call to the function containing two return
statements. If the value entered by the user is less than
and equal to I then the value I is returned else computed
factorial is returned.
The type of the expression returned is integer.
Pass by value
In ‘pass by value’ mechanism copies of the argument are
created and which are stored in the temporary locations
of the memory. The parameters are mapped to the
copies of the arguments created. ‘Pass by value’
mechanism provides security to the calling program.
#include<iostream.h>
using namespace stdlnt add (int n);
int main()
{
lnt number, result;
number=5;
cout«"the initial value of the numbe"«number«endl;
result=add( number);
cout«" the final value of the number"«number«endl;
cout«"the result is"«result«endl;
return(o);
}
int add(int number)
{
number =number + 100;
return(number);
}
Pass by reference
Pass by reference is the second way of passing
parameters to the function. The address of the argument
is copied into the parameter. The changes made to the
parameter affect the arguments. The address of the
argument is passed to the function and function modifies
the values of the arguments in the calling function.
Here is the program which illustrates the working of pass
by reference mechanism:
#include <iostream.h>
namespacestd;
int add {int&, number);
int main()
{
int number;
int result;
number=5;
cout«" the value of the variable number before
calling the function" <<number<<endl;
result=add(& number);
cout«"the value of the variable after the function is
returned is"«number«endl;
cout«"the value ofresult"«result«endl;
return(0);
}
int add(int&p)
{
*p=*p+ 1000;
return(&p);
}
Files used
Classes
- class student
This class stores the name of the student, username,
password and roll number .The class allows the
student to create a library account. It also acts as a
login portal for registered users.
- Class library
This class is used to store the details of the available
books in the library and allows the user to access the
details of the book. The class also allows the user to
rent the books and to return the rented books under
their registration.
Functions used
- void main();
This function is executed first during runtime. It
contains a menu driven program using switch case
which facilitate the user to access all operations.
- void createaccount();
This function allows the user to create a library
account .
- void login();
This function displays a login portal for registered
users.
- void retbook();
This function allows the user to return the rented
books under their registration.
- void searchbooks();
Displays the Best selling Books available in the
library and allows the user to select a book to rent
from the list of books . It also contains a menu
driven program , which permit the user to view the
details of the selected book and also to rent the book
under his registration , if he wishes so .
- void display();
Displays all the available Best selling books in the
library
- void details();
This function displays the details of the selected Book
by accessing it’s respective binary file
- void writefile();
This function writes the details of the books in it’s
respective Binary File .
- void rent();
Allows the user to rent the book under their
registration.
- int bkprice();
Returns the normal price of the book.
- int bksprice();
Returns the price of special edition of the same book.
FUTURE
ENHANCEMENTS
- Graphics could be included to make the software
more interacting .
- Options to purchase products on loan could be
included.
- Time and date for purchase could be included.