Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 19

THE VELAMMAL INTERNATIONAL SCHOOL

PANCHETTI, CHENNAI – 601 204

AISSCE – 2020

COMPUTER SCIENCE PROJECT

DEPARTMENT OF COMPUTER SCIENCE

2019-2020
THE VELAMMAL INTERNATIONAL SCHOOL

COMPUTER SCIENCE PROJECT

CERTIFICATE

This is to certify that this is the bonafide record of project


work done by Master/ Miss.___________________ of
Grade XII during the academic year 2019-2020.

Submitted for AISSCE Computer Science Practical


Examination held on _______at The Velammal
International School, Panchetti, Tiruvallur District.

Date: __________

PRINCIPAL INTERNAL EXAMINER EXTERNAL EXAMINER

2
ACKNOWLEDGEMENT

First of all we thank our beloved parents for providing us the


opportunity to study in The Velammal International School.

We thank our beloved Director Sri.M.V.M.SASIKUMAR for


being our motivational force for the completion of this project.

We thank our Senior Principal Sri. K.KOTHANDARAMAN,


and Principal Sri. S.MADHAVA KRISHNA and Head of the department
Smt. K .HEMALATHA SRI for their exceptional support.

We thank our Computer Science Teacher and project guide


Sri. CH. BALASUBRAMANYAM for encouraging and guiding us to
complete this project.

Last but not the least I thank all my friends who helped me in
the completion of this project.

3
OBJECT – ORIENTED PROGRAMMING PARADIGM

Object – Oriented Programming is the most dramatic innovation in the software


development. Large programs are probably the most complicated entities ever
created by humans. Because of the complexity, programs are prone to error, and
software errors can be expensive and even life threatening. Object – Oriented
Programming offers a new and powerful way to cope this complexity. Its goal is
clearer, more reliable and to create more easily maintained programs. It involves
concepts that are new to traditional programmers.
PARADIGM:
Organizing principle of a program. It is an approach to programming.
PROCEDURE PROGRAMMING:
In Procedure – oriented approach, it views a problem in terms of procedure involved
rather than objects for doing it. (Importance to procedures not objects).
OOP PROGRAMMING:
In object – oriented approach, it views a problem in terms of objects involved rather
than procedure for doing it.
OBJECTIVE OF OOPS:
1. Data is given more emphasis than procedure.
2. Programs are divided into what are known as objects.
3. Data structures are designed such that they characterize the objects.
4. Functions that operate on that data of an object are typed together in the Data
structures.
5. Objects communicate with each other through functions.
6. New data and functions can be easily added whenever necessary.
7. It follows bottom up approach in programming.

4
BENEFITS OF OOP:

 Through inheritance, we can eliminate redundant code and extend the use of
exiting.
 classes
 Data hiding helps the programmer to build secure programs that cannot be
invaded by code in other parts of the program.
 It is easy to partition the work in a project based on objects.
 Object oriented systems can be easily upgraded from small to large systems.
 Software complexity can be easily managed
 It returns the used memory in constructor through destructor.
 Message passing (Invoke a variable or function in the receiving object that
generates the desired result).
 Function overloading (same function name and different argument)
 Pointers (secure programs as well as memory saving)
ABSTRACTION:
Abstraction refers to the act of representing essential features without including the
background details or explanations.
REAL LIFE ENTITY:

“Switch Board” – we need to know only its essential features that is what all
switches are to be pressed and the background details like wiring and circuitry are
hidden from us.
class Account
{
int accont_no; char type; float balance;
float deposit ( float amount )
{
balance = balance + amount; return balance;
}
float withdraw ( float amount )

5
{
balance = balance - amount; return balance;
}
};
void main( )
{ Account A1;
A1.deposit ( 2000 );
A1.withdraw ( 1000 );}
In this program we access deposit and withdraw functions without including the
manipulation.
ENCAPSULATION:

Encapsulation refers to wrapping up data and associated functions into one single
unit.
class Account
{
int accont_no;
float balance;
float deposit ( float amount )
{
char type;
balance = balance + amount;
return balance;
}
float withdraw ( float amount )
{
balance = balance - amount;
return balance;
}
};

6
void main( )
{
Account A1;
A1.deposit ( 2000 );
A1.withdraw ( 1000 );
}
In this program we wrap type of deposit in deposit function

DATA HIDING:
The class groups its members ( data & functions ) into three sections : private,
protected and public, where private & protected members remain hidden from
outside world and thereby support data- hiding.

MODULARITY:

The act of partitioning a program into individual components is called modularity.

The justification for partitioning a program is that


1. it reduces its complexity
2. it creates a number of well – defined program
3. it creates a readable program.
4. it creates a understandable program

INHERITANCE:

Inheritance is the capability of one class of things to inherit capabilities or properties


from another class.
Types:
1. Single inheritance - When a subclass inherits only from one base class.
2. Multiple inheritance - When a subclass inherits from multiple base classes.
3. Multilevel inheritance - When a subclass inherits from a class that itself inherit
from another class.
4. Hybrid inheritance - When a subclass inherits from multiple base classes and
all of its base classes inherit from a single base class.

7
5. Hierarchical inheritance - When many subclasses inherits from one base class.
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.
C++ CHARACTER SET:

Character set is a set of valid characters that a language can recognize.

Letters A – Z, a – z

Digits 0–9

Special Symbols Space + - * / ^ \ ( ) [ ] { } = < >. ‘ “ $ , ; : % ! & ? _ # @

White Space Blank space, Horizontal tab (  ), Carriage return, New line

Other Characters 256 ASCII characters.

TOKENS
The smallest individual unit in a program is known as a Token. C++ has five tokens.
1. Keyword
2. Identifiers
3. Literals
4. Punctuations
5. Operators
KEYWORD:
These are the words that convey a special meaning to the language compiler.
Example: for, do, while, int, char, it, etc….
IDENTIFIERS:
An identifier is an arbitrarily long sequence of letters and digits. The first character
must be a letter. The underscore (_) counts as a letter. Upper and lower case letters
are different. All characters are significant.
Example: myfile, dat_name, z2, etc …

8
LITERALS:
Literals are data items that never change their value during a program run.
Integer – constants : Whole numbers ( 1, 20,…)
Character – constants : One character contained enclosed in single quotation
marks( ‘a’, ‘4’,….)
Floating – constants : Numbers having fractional parts. (1.12, 17.5,….)
String – constants : One or more characters contained enclosed in double
quotation marks. ( “a”, “welcome”,….)
PUNCTUATIONS:
These characters enhance a program’s readability and give proper meaning to
statements.
( [ ] ( ) { } , ; : * …. = # )
OPERATORS:
Operators are tokens that trigger some computation or action when applied to
variables and other objects in an expression.
( +, <= , != , etc….)
FORMATTING OUTPUT:

Formatting output is important in the development of output screens, which can be


easily read and understood.
\n - new line
\t - horizontal tab
setw(6) - set the width of the field
setprecision(5) - set the number of decimal places to be displayed
cout.setf(ios::fixed) - set the number of decimal places to be displayed
cout.setf(ios::left) - set the number of decimal places to be displayed on left
side.

9
Array - An array is a collection of variables of the same type that are referenced by
a common name.
Structure - A structure is a collection of variables referenced under one name but
different data types.
Function – A function is a named part of a program that can be invoked from other
parts of the program as often needed.
Pointer – A pointer is a variable that holds a memory address. This address is
usually the location of another variable in memory.
Classes – A class contains related variables and functions together.

VARIABLES:

Variables represent named storage locations whose values can be manipulated during
program run.
Memory space :

Integer Variables - 2 bytes

Character Variables - 1 byte

Float Variables - 4 bytes.

ifstream fin - file input

ofstream fout - file output

ARRAYS:

Arrays are a way to group a number of items into a larger unit. Arrays can have data
items of simple types like int, char or even of user – defined types like structures and
objects.
An array is a collection of variables of the same type that are referenced by a
common name.

10
Types:
1. One dimensional arrays ( int a[10] )
2. Two dimensional arrays ( int a[3][10] )
3. Multi dimensional arrays ( int a[3][2][5] )
Example:
int a[10];
for(int i = 1; i < =10; i ++ )
cin>>a[i];

STRUCTURE:

A structure is a collection of variables referenced under one name, providing of


convenient means of keeping related information together.
struct student
{
int rollno;
char name[20];
int class;
float marks;
char grade;
} student S1,S2;

The above declaration declares a structure named student with structure elements
rollno, name, class, marks and grade. The last line create structure objects are s1,s2.
CLASS:

A class is a way to bind the data describing an entity and its associated functions
together.
In C++, class makes a data type that is used to create objects of this type.
class Account
{

11
int account_no;
char type;
float balance;
float deposit ( float amount )
{
balance = balance + amount;
return balance;
}
float withdraw ( float amount )
{
balance = balance - amount;
return balance;
}
};
OBJECT:

Object is an identifiable entity with some characteristics and behaviour.

In the above class is invoked in main function through A1 object.

void main( )
{
Account A1;
A1.deposit ( 2000 );
A1.withdraw ( 1000 );
}

IF STATEMENT:

 Simple if statement
 If….else statement

12
SIMPLE IF STATEMENT:
if ( test expression)
{
Statement 1;

Statement 2;
}

If Construct – if statement with test expression, if the test expression evaluates to


true then Statement 1 & Statement 2 displayed otherwise Statement 2 only
displayed.
IF ELSE STATEMENT:

if ( test expression)
{
Statement 1;
}
else
{
Statement 2;
}
If Else Construct – if statement with test expression, if the test expression
evaluates to true then Statement 1 only displayed, if the test expression evaluates to
false then Statement 2 only displayed.
SWITCH STATEMENT:

C++ provides a multiple – branch selection statement known as switch. This


selection statement successively tests the value of an expression against a list of
integer or character constants. When a match is found, the statements associated
with that constant are executed.

13
FOR LOOP:

The for loop is an entry – controlled loop and is used when an action is to be
repeated for a predetermined number of times.
Syntax
for (initial value; test; increment or decrement)
{
action 1;
}
action 2;
WHILE LOOP:
While loop is executed only when the test condition is true, if it is false, it will come
out of the loop. It has no initialization expression or increment expression.
Syntax

while (test expression)


{
action 1;
}
action 2;
DO – WHILE LOOP:
The Do - while is an exit – controlled loop and it evaluates its test – expression at the
bottom of the loop after executing its loop – body statements. This means that do –
while loop always executes at least once, even when the test expression evaluates to
false initially.
Syntax
do
{
action 1;
}

14
while (test expression)
action 2;

BREAK:

The break statement enables a program to skip over part of the code. A break
statement terminates the smallest enclosing while, do – while, for or switch
statement.
Syntax

break;

A break statement skips the rest of the loop and jumps over to the statement
following the loop.
Example

for(int i = 0 ; i < 10; i++)


{
cout<<i<<endl;
if(i>5)
break;
}
cout<<”over”;

it prints 1 to 5 then statement “over”

FILES:

Most computer programs work with files. This is because files help in storing
information permanently.

In C++, file input/output facilities are implemented through a fstream.h header file.

It defines certain classes that help one perform file input and output.

ofstream – read operation

ofstream – write operation

fstream – both read and write operation

15
Example: write and read of a text file

void main()
{
char ch;
clrscr();
ofstream fout("student.txt",ios::out);
char name[30];
for(int i=0;i<5;i++)
{
cout<<"Enter Five Names :";
cin.get(name,30);
cout<<"\n";
cin.get(ch);
fout<<name<<'\n';
}
fout.close();
ifstream fin("student.txt",ios::in);
fin.seekg(0);
for(i=0;i<5;i++)
{
fin.get(name,30);
fin.get(ch);
cout<<"Names are :"<<name<<endl;
}
fin.close();
getch();
}

16
RANDOM ACCESS:

We can randomly access our files through some functions.

seekg( ) - will move the get_pointer to the specified byte in the file.

Example:
seekg(0) - move the get_pointer to the staring location.

seekg(30) - move the get_pointer to byte number 30.

seekp( ) - will move the put_pointer to the specified byte in the file.

Example:
seekp(0) - move the put_pointer to the staring location.

seekp(30) - move the put_pointer to byte number 30.

Tellg( ) and tellp( ) ( return positon of pointer) works in the same way as seekg( )
and seekp( ).

FILE COMMANDS:

Deleting a file - remove(“stu.dat”);

Renaming a file - rename(“temp.dat”,”stu.dat”);

eof( ) - End of file

To seek a rollno

if( prev.getrno( ) < = stu.getno( ) && stu.getno( ) < = next.getrno( ) )

HEADER FILES:

#include<iostream.h> - Declares the basic C++ (version 2.0) streams


(I/O) routines.
#include<conio.h> - Declares various functions used in calling the
DOS console I/O routines.

17
#include<stdio.h> - Defines types and macros needed for the
Standard I/O Package defined in Kernighan and
Ritchie and extended under UNIX System V.
Defines the standard I/O predefined streams
stdin, stdout, stdprn, and stderr, and declares
stream-level I/O routines.
#include<process.h> - Contains structures and declarations for the
spawn... and exec... functions.
#include<fstream.h> - Declares the C++ stream classes that support file
input and output.

I/O STREAM FUNCTIONS:


1. close ( ) - closes a file associated with a handle.
2. eof( ) - determines whether the associated the handle has
reached end of file.

FILE STREAM FUNCTIONS:

1. tellg ( ) - returns the current stream position.

2. open ( ) - opens a file for reading or writing.

PROCESS FUNCTION:

1. exit( ) - To exit from normal program

18
BIBLIOGRAPHY

BOOKS AUTHORS

 Computer science C++ - Sumitha Arora

 Object oriented programming - E.Balaguruswamy

 C++ primer plus - Robert Lafore.

 Object oriented programming - Robert Lafore

 Let us C++ - Yashwant Kanetkar

19

You might also like