You are on page 1of 39

Project Report

On

VOTING SYSTEM
Submitted in the partial fulfillment of the requirement for the award of degree of

Bachelors of Technology
in

Computer Science and Engineering

Submitted to: Er.Anju

Submitted by Gurdeep Singh 100820392107

Department of Computer Science & Engineering


Swami Vivekanand Institute of Engineering & Technology Banur

Acknowledgement
It is my privilege and delectableness to acknowledge with the deepest sense of gratitude, the keen personal interest and invaluable guidance goes to my guide. For his support, encouragement and help me at every stage of project, while I did face any problem regarding my project of railway enquiry system. This work simply would not have reached up to such extent without his cognitive and rational guidance and guidelines. Finally, we are indebted to all who so ever have contributed in this project.

Gurdeep Singh

Introduction to the Project


In our program we have develop a program in C++ for storing the information of the citizens & the candidates who are come in election. First of all a main menu appears which has two separate functions. These two menus has their own sub-menus. First voting list & second voting system.

In voting list:
There are 5 separate operations: 1. Adding the data of citizens. 2. Displaying data 3. Searching data 4. Deleting data 5. Modify data

In voting system:
1. 2. 3. Add the info. Of Candidates view the info. Of Candidates Voting System

There are only 2 candidates. When anybody vote for any candidate the he/she has to enter their vote number if his/her vote number exist then he has to permission to vote. If their number does not exist he/ she cannot vote to any candidate. Any person cannot vote more than once. Because when he/she enter their vote number first time then his/her record will have been deleted from list.

INBUILT FUNCTIONS Used in our Project

Clrscr();
The text mode window of screen is cleared. Defined in <conio.h>

Cprinf: Exit():

writes formatted output to text window on thw screen and returns the numbers of bits output. Defined in <conio.h> The program is terminated. Defined in <process.h>

Gotoxy(int,int): position cursor in the text window to coloum x of row y.


Defined in <conio.h>

Remove(file name); Write() Strcmpi(); Fstream

these macros removes the files. Defined in <conio.h>

Length of bytes written to memory. <istream.h> it compares the unsigned strings without case sensitive Defined in <string.h>

it permits the file to open in both modes using a common file stream.
Defined in <fstream.h> Modes of fstream Ios::in open in read mode Ios::out open in write mode Ios::app set the cursor at end of the file in write mode

Ifstream: Ofstream : Close(); Textcolor(int);

It opens the file in read only mode. Defined in <fstream.h> It open the file only write mode. Defined in <fstream.h> if close the file. It changes the text color on the text window. Defined in <conio.h>

Break: Return: Getch();

to exit from the current loop return to previous function where we called it. get a char from keyboard(standard input device).<conio.h>

Software Requirements and Specifications


1.Software & Hardware Specifications:
Hardware specifications:

The following is the hardware specifications of the system on which the software has been developed needs for the proper working of the software:CPU
HDD RAM FDD CDROM MOUSE KEYBOARD

PIII processor with 866 kHz speed


20 GB 128 MB 3.1/4,1.44MB 52x(LG) Logitech 105 Keys

Software specifications:

The following software are used to develop this software:

Operating system Language used Database

windows 98 C++ C++ files

2. Feasibility study

Feasibility study is carried out to test is the proposed system is worth being implemented. Given unlimited resources and infinite time, all project are feasible. Unfortunately, such situations are not possible in real time. Hence it becomes necessary and prudent to evaluate the feasibility of the project at earliest possible time in order to avoid unnecessary wastage of time. Feasibility study is the test of the system proposed regarding its work ability, impact or organizations ability to meet users needs and effective use of resources. It is usually carried out by a small group of people who are familiar with the information system technique, understand the part of business that will be involved and affective by the people that are skilled in analysis and design. A feasibility study is conducted to select the best system that meets the performance requirements. This entails an identification description, and emulation of candidate systems and selection of best system for the job. The factors that should be included in the feasibility assessment can be as follows.

Cost : operating, maintenance, unit Accuracy: frequency, significance and correction of errors Reliability: stability, durability Capacity: average, low and peak loads

3. SYSTEM ANALYSIS
Analysis is a detailed study of the various operations performed by a system and their relationship within and outside of the system. In journal view system is collection of people, procedures and equipments. People are not an important component of any information system. Information is produced and used by people in an organization in their everyday activities to make decisions. Information system establishes procedures ensuring that right people receive right data at right time. These procedures determine what is to be done at it enter and passed through the system. System analysis is the method that is used to analyse the system, design them and build them. Analysis is used to gain an understanding of existing and what is required in system. The analysis phase ends with the system description and a set of requirement of the new system. Analysis is a process of diagnosis the situation with the boundaries of system kept in mind to produce a report based own findings. Planning for information system development is done within in the framework of organizations overall MIS plan.

Identification of need Detailed information requirement analysis of organization is collected from present system. Time tells the difference. As a person has to be changed with the prevailing conditions of society, in the same a system has to be changed accordingly. Computerized organization is the todays demand. In comparison to the old system, the computerized system is more reliable and cost effective. In the present organization, the data is scattered whereas the data should be integrated at one place so that the

modifications can be made easily and it becomes easy for any authorized person to get information from these files.

To make data consistent the organization need to be automated. The main requirement that can be viewed fro here can be as follows: 1. compete records of trains 2. details of stoppage and routes 3. record of stations 4. detailed timing schedule

Objectives (i) efficiency: when all the work is done by computer then it will increase the efficiency, so all the activities will be done fastely (ii) (iii) this system also save time for making the route of desired journey convenient environment for passengers as well as operator

at present time, every person is in hurry, nobody has spare time. Every passenger wants quick service. With this software, every passenger will avail every type of services.

4. System Design
The design phase focuses on the detailed implementation for the system recommendation in the feasibility study. The design phase is a translation from a program-oriented-document to user-oriented-document. The design activity begins when the required document for the software to be developed is available. This may be SRS for the complete system, in case of waterfall model is being followed or the requirement for the next iteration, if the iterative enhancement is being followed or the requirement for the prototype if the prototyping is being followed. Design is essentially the bridge between requirement specification and the final solution for satisfying th requirements. The term design is used in two ways, when used as a verb it represent the process the designing while it represents the result of design process. The goal of design process is to produce some order, which can be later used to build that system. The produced model is called the design of the system. The design of the system is essentially a blueprint or a plan for solution for the system. Here we consider a system to be asset of components which clearly defines the behaviour that interacts with each other in a fixed define manner. A component of a system can be3 considered as a system with its own components. In a software system a component is a software module. The design process for software system has two levels, Top level and logical design. In top level, it is indicated that how the modules should be integrated. Logical design expands the system design to contain more detailed description of processing logic and data structures.

Design is essentially the bridge between requirement specification and the final solution for satisfying the requirements. The term design is used in two ways, when used as a verb it represent the process the designing while it represents the result of design process. The goal of design process is to produce some order, which can be later used to build that system. The produced model is called the design of the system. The design of the system is essentially a blueprint or a plan for solution for the system. Here we consider a system to be asset of components which clearly defines the behaviour that interacts with each other in a fixed define manner. A component of a system can be3 considered as a system with its own components. In a software system a component is a software module.

Various Flowcharts defining the process of system are:

Voting sys

Are you ready for voting

If yes

If no

Enter your vote number

Remove();

Select option Candidate 1 Vote++ Candidate 2 Vote++

Return for voting;

In voting system, first the voter have to agree for vote. If he is agree then he/she has to enter their vote number , after this if his/her name in the voting list then he/she can vote other wise he/she can not vote to any candidate. If his/her name is exist in voting list then it will remove from here then can vote to their respective candidate.

Insertion in list
Add();

Enter record obj.get()

Write into file: f.write((char*)&obj,sizeof(obj));

Enter more records : - press 1

If (ch==1)

Return;

Whenever insertion function (add() in prog,) is called then you have to the required information. A object of class voter is made for inserting the records. Then it is write into the file. If you want to enter the more records then you have to press 1 for inserting the next record using that object.

Displaying the list

Dis();

Scan the file

Obj.dis();

While File is not empty

Else end of file

Return;

When the display function will be called then the file will be scanned record by record then display that records. If the file is empty then return to previous menu

Searching from the list


Search()

By vote no.

By Name

Scan file

Obj.dis()

If search

While not search

Return;

When ever the search function is called then it will first scan the file then display the record. This process is continue till the end of file. This can be done through two ways. By voting number or By voter name (according to our project.

Deletion From List

Remove(char*)

Read the record file

Then obj. write to Temporary file

yes

If Vote no Not search

no

Delete the original file & rename the temporary file

return

This flow chart for deleting the record form list. First list will be scanned record by record. If the record does match with the selected record then it will write to file otherwise not. Then duplicate file rename with original file name.

Modify the record

Modi();

Enter the vote no to be modified

Scan the file

While eof()

Write the records in temporary file

If not search

Delete original file & rename the temporary file to original name

Enter new record

Return;

Whenever the modi() function is called the first it will scan the file record by record. Then if the record is searched to be modify then you have to enter the required information and write into the duplicate file. If no t searched that record then that record also write into duplicate file. At last , duplicate file is rename with original name.

5.Coding of this project


This progam is divided into to programs: 1. 2. voter.cpp project.cpp

the program voter.cpp includes into the project.cpp program.

Voter.cpp: There are the two classes voter & candi which has their own data members; The various finctions 1. add() 2. modi() 3. remov() 4. disp() 5. srearch() are declare and defined here. Project.cpp:The are the functions of voting system. In this program candidates can enter their information, displays the information & the main function of the project is defined here.

Coding of VOTER.CPP
#include<iostream.h>

class candi
{ char nm[20]; char party[10]; int age; char addr[50]; char sym[10];

public: void get() { cout<<"Enter the 'Candidate's' name\t"; cin>>nm; gotoxy(25,6); cout<<"Enter his/her party\t"; cin>>party; gotoxy(25,8); cout<<"Enter his/her age\t"; cin>>age; gotoxy(25,10); cout<<"Enter his Symbol Nmae\t"; cin>>sym; gotoxy(25,12); cout<<"Enter his/her Address\t"; cin>>addr; } void dis() { cout<<endl<<"\t\t"<<nm<<"\t"<<party<<"\t"<<age<<"\t"<<sym<<"\t"<<addr; } char *g_party() { return(party); } char *g_nm() { return(nm); } };

class voter
{ char v_no[10]; char nm[20]; char fnm[20]; int age; char addr[50]; public: void get() { gotoxy(20,6); cout<<"Enter vote no:\t\t"; cin>>v_no; gotoxy(20,8);

cout<<"Enter your name:\t"; cin>>nm; gotoxy(20,10); cout<<"Enter Father name:\t"; cin>>fnm; gotoxy(20,12); cout<<"Enter your age:\t\t"; cin>>age; gotoxy(20,14); cout<<"Enter your address:\t"; cin>>addr; } void dis() { cout<<endl<<v_no<<"\t"<<nm<<"\t"<<fnm<<"\t"<<age<<"\t"<<addr; } char *getv_no() { return(v_no); } char *getnm() { return(nm); } };

void search(); void add(); void disp(); int remov(char *); void modi(char *);
void add() { voter obj; int ch; clrscr(); fstream f; f.open("test",ios::out|ios::app); do { clrscr(); cout<<"**********************\n"; cout<<"Enter record:\n";

cout<<"**********************\n"; obj.get(); f.write((char*)&obj,sizeof(obj)); cout<<"Press 1 for conti....\t"; cin>>ch; }while(ch==1); f.close(); }

void disp() { clrscr(); cout<<endl<<"___________________________________________________________ _________\n"; cout<<"V.no\tName\t\tF.Name\tAge\tAddress\n"; cout<<"----------------------------------------------------------------------\n"; voter obj; ifstream f("test"); f.read((char*)&obj,sizeof(obj)); while(f) { obj.dis(); f.read((char*)&obj,sizeof(obj)); } f.close(); cout<<"\n\nPress any button:......\t"; getch(); }

int remov(char *vno) { fstream f,ff; voter obj; int flag =0; f.open("test",ios::in); if(!f) { return flag; }

ff.open("test.tp",ios::out); while(1) { f.read((char*)&obj,sizeof(obj)); if(f.eof()) break ; if(strcmpi(obj.getv_no(),vno)!=0) ff.write((char*)&obj,sizeof(obj)); } ff.close(); f.close(); f.open("test",ios::in); ff.open("test.tp",ios::in); int a=f.tellg(); int b=ff.tellg(); ff.close(); f.close(); remove("test"); rename("test.tp","test"); if(b<a) { flag=1; return flag; } else return flag; } void modi(char *vno) { fstream f,ff; voter obj; f.open("test",ios::in); if(!f) return ; ff.open("test.tp",ios::out); while(1) { f.read((char*)&obj,sizeof(obj)); if(f.eof()) break; if(strcmpi(obj.getv_no(),vno)==0) { cout<<"Enter new record:\n"; obj.get(); }

ff.write((char*)&obj,sizeof(obj)); } ff.close(); f.close(); remove("test"); rename("test.tp","test"); }

void search() { clrscr(); fstream f; voter obj; gotoxy(20,6); cout<<"*********************************\n"; gotoxy(20,8); cout<<"1. Search by Vote Number:\n"; gotoxy(20,10); cout<<"2. Search by Name:\n"; int a; gotoxy(20,12); cout<<"Enter your choice\t"; cin>>a; switch (a) { case 1: clrscr(); f.open("test",ios::in); char v_srch[10]; gotoxy(20,6); cout<<"Enter your vote number for searching.....\t"; cin >>v_srch; if(!f) { gotoxy(20,6); cout <<"file does not exist\t"; } while(1) { f.read((char*)&obj,sizeof(obj)); if(f.eof()) break;

if(strcmpi(obj.getv_no(),v_srch)==0) obj.dis(); } f.close(); break; case 2: clrscr(); f.open("test",ios::in); char v_s[20]; cout<<"Enter your Name for searching.....\t"; cin >>v_s; if(!f) { gotoxy(20,6); cout <<"file does not exist\t"; } while(1) { f.read((char*)&obj,sizeof(obj)); if(f.eof()) break; if(strcmpi(obj.getnm(),v_s)==0) obj.dis(); } f.close(); break; default: gotoxy(20,6); cout<<"Enter wrong Choice\n"; getch(); break; } // } gotoxy(20,10);cout<<" press any key......."; getch();

Coding of #include<iostream.h> #include<string.h> #include<graphics.h> #include<fstream.h> #include<conio.h> #include<process.h> #include<stdio.h> #include"voter.cpp"

project.cpp

void vot_menu(); void vot_sys(); void c_get(); void c_dis(); void vo_sys(); void choice();

void vot_menu()
{ char ch; clrscr(); while(1) { clrscr(); textcolor(6); cout<<"\t"; cprintf(" *************************************************************\n"); cout<<"\t "; textcolor(3); cprintf(" WelCome To Voter List\n"); cout<<" \t "; textcolor(3);

cprintf("*************************************************************\n"); gotoxy(25,6); textcolor(1); cprintf("1. Insertion In Voting List\n"); gotoxy(25,8); cprintf("2. Displaying The List Infomation\n"); gotoxy(25,10); cprintf("3. Searching Record\n"); gotoxy(25,12); cprintf("4. Deleting The Record \n"); gotoxy(25,14); cprintf("5. Modify The Record\n"); gotoxy(25,16); cprintf("6. Exit\n"); gotoxy(25,18); textcolor(8); cprintf("Enter Your Choice "); cin>>ch; switch(ch) { case '1': add(); break; case '2': disp(); break; case '3': search(); break; case '4': char vo[10]; clrscr(); cout<<"\t*******************************************************\n"; cout<<"Enter vote number to be deleted:\t"; cin>>vo; cout<<"\t*******************************************************\n"; if(remov(vo)==0) { cout<<"your record is deleted from list\n"; cout<<"press any key"; getch(); } else

{ cout<<"your record is not deleted from list\n"; cout<<"press any key"; getch(); } break; case '5': clrscr(); char v[10]; cout<<"Enter the vote no for Updation"; cin>>v; modi(v); break; case '6': return; } } }

void main() { char ch; while(1) { clrscr(); textcolor(6); gotoxy(25,8); cprintf("-->1. Voting List\n"); gotoxy(25,10); cprintf("-->2. Voting System\n"); gotoxy(25,12); cprintf("-->3. Exit"); gotoxy(25,14); cout<<"Enter your choice\t"; cin>>ch; switch(ch) { case '1': vot_menu(); break; case '2': vot_sys();

break; case '3': exit(0); } } } void vot_sys() { char ch; while(1) { clrscr(); textcolor(9); gotoxy(25,8); cprintf("1. Enter The Candidate's Information\n"); gotoxy(25,10); cprintf("2. See The Candidate's Information\n"); gotoxy(25,12); cprintf("3. Start For Voting\n"); gotoxy(25,14); cprintf("4. Exit"); gotoxy(25,16); cout<<"Enter Your Choice\t"; cin>>ch; switch(ch) { case '1': c_get(); break; case '2': c_dis(); break; case '3': vo_sys(); break; case '4': return; } } }

void c_get() {

clrscr(); candi obj; ofstream fl("can.txt"); gotoxy(25,6); textcolor(3); cout<<"Enter the data of 2 candidates->"; getch(); for(int i=0;i<2;i++) { clrscr(); gotoxy(24,2); cout<<"Enter the data of "<<i+1<<" Candidate\n\n"; gotoxy(24,4); obj.get(); fl.write((char*)&obj,sizeof(obj)); } }

void c_dis() { clrscr(); ifstream fl("can.txt"); candi obj; gotoxy(15,4); cout<<"*****************************************************\n"; gotoxy(15,5); cout<<"Name\tParty\tAge\tSymbol\tAddress\n"; gotoxy(15,6); cout<<"*****************************************************\n"; if(!fl) { gotoxy(25,8); cout<<"no file exist."; gotoxy(25,10); cout<<"press any key"; getch(); return; } fl.read((char*)&obj,sizeof(obj)); while(fl) { obj.dis();

fl.read((char*)&obj,sizeof(obj)); } fl.close(); gotoxy(25,18); cout<<"Press any key........"; getch(); } void vo_sys() { clrscr(); gotoxy(20,4); cout<<"************************\n"; gotoxy(20,5); cout<<"welcome to voting system\n"; gotoxy(20,6); cout<<"************************\n"; char ch; gotoxy(20,8); cout<<"Are You Ready For Voting(y/n): \t"; cin>>ch; if(ch=='y') { char ch,vno[10]; clrscr(); gotoxy(25,4); cout<<"Are you Sour(y/n):- \t"; cin>>ch; if (ch=='y') { clrscr(); gotoxy(25,10); cout<<"Enter your Vote no"; cin>>vno; remov(vno); choice(); } else return ; } }

void choice()

{ clrscr(); char ch; gotoxy(20,4); cout<<"1 for first candidate "; gotoxy(20,6); cout<<"2 for second candidate"; lable: { gotoxy(20,10); cout<<"Enter your choice"; cin>>ch; } switch(ch) { case 1: clrscr(); gotoxy(25,4); cout<<"Your 1"; break; case 2: clrscr(); gotoxy(25,4); cout<<"your 2"; break; default: goto lable; } }

Screen Shots of Project


Main menu: -

By pressing 1 you will enter in the voting list manager By pressing 2 you will enter in the voting system By pressing 3 you will Exit from the project

Voting List menu: -

Now we have selected 1 from main menu & voting list menu appears on window There are 5 Functions to operate the operation on voting list data

Inserting data Displaying the list Searching from list Delete the record Modify the record

Press 1 to insert the data press 2 to display the list Press 3 for searching press 4 for Deleting the particular record press 5 for Updating the record

Insertion in the list

After pressing 1 This window will be appear then you can enter the following information

Displaying the list

By pressing 2 You can see the list of records

Searching From list

By pressing you will login this window Then you can search the records by vote number & by name

For example: We have find a record by name

Modify the record: -

By pressing 5 you will login this window. You will have to enter your vote number to modify the record. If the record matches in the list you can enter new record else you will return to voting list menu.

For example: -

After updation the record

Delete a particular record:

When you press the 4 you this window will be appear If you enter the valid vote number you recordll be deleted from here. Else no record deleted from here

Voting System Menu

When you press 2 on the main menu then you will login the voting system window There are also3 functions 1. Enter the info. Of candidates 2. displaying the info. Of candidates 3. Start to voting 4. Exit

6.Implementation
Implementation
It is one of the main modules of the project development stage. All the work done as earlier comes near to end when I am going to implementing the project. I tried my best to fulfill all the requirements of the Railway Enquiry System. However, implementation can be taken finalize the testing procedure. But if we implement the project there is not any standardized procedure to check the testing while implementation give us chance to test if there is any problem, it can be taken remedies so we can finalise the project, using implementation and reviewing techniques. So far, this project is concerned; it is free from errors and can be implemented very effectively.

Testing Testing is a dynamic method for verification and validation, where the system to be tested is executed and behavior of the system is observed. Due to this, testing observes the failures of the system, for which the presence of faults can be deduced. However, separate activities have to be performed to identify the faults and then remove them. There are two approaches to testing, functional and structural. In functional testing, the internal logic of the system under testing is not considered and the test cases are decided for the specifications or the requirements. It is often called black-box testing. In structural testing, the test cases are decided entirely on the internal logic of the program on module being tested. The external specifications are not considered. Mutation testing is another approach for structural testing that created mutants of the original program.

The testing criterion is to kill all the mutants by having the mutant generate a different output from the original program. Unit testing is used to test a module and the focus are combined into subsystems which are then tested. The goal here is to test the system design. Structural testing can be used for unit testing, while at higher level mostly functional testing is used. During the test case, execution phase the test cases are executed and various reports are produced for evaluating testing. The main output of the execution phase is the test log, the test summary report and the error report.

Maintenance Maintenance is a provision, which includes both the improvement of system functions and the correction of faults which arise during the operating of system. Maintenance activity may require the continuing involvement of a large proportion of computer resources. When we install the software, chances arise in two ways (I) As a part of normal running system where errors are found, user may ask for improvement or external requirements change. (II) As a result of specific investigation and review of system performance.