Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 55

Voting System

A Summer Training Project Submitted in partial fulfilment of the


requirements for the Award of degree of Bachelor of Computer
Applications

2020 – 2023

Submitted by Pradeep Pandey Guided by Ms.Nimisha Arora

Student undertaking
[1]
Name Pradeep Pandey So Umesh Kumar Pandey. Course BCA Semester IV. PRN 2128100715

Admission Session June. Address BG-3 37/E Paschim Vihar New Delhi 110063. Mobile no.
8527615886

I hereby declare that this Project made by me with the small help of my senior and online
blogs my friends and teachers

Student of the Student

[2]
Certificate from Internal Guide

[3]
Certificate from the Director

[4]
Preface

The above code is a program for conducting an election using a student panel and an
admin panel. It allows students to log in with their user ID and vote for candidates,
while the admin panel provides functionalities such as initiating a new election,
deleting illegal votes, banning user IDs, and viewing election results.

The code utilizes data structures and file handling to store information about
candidates, student votes, and banned IDs. It includes functions for extracting the year
and roll number from a user ID, checking the validity of a user ID, authenticating the
admin, saving and loading election information from files, and performing various
election-related operations.

Please note that the code provided is incomplete, and sample inputs and
outputs are not available. If you have any specific questions or need assistance with a
particular aspect of the code, please let me know, and I'll be happy to help.

[5]
Acknowledgement
I would like to express my deepest gratitude and appreciation to the following
individuals and organizations who have supported and contributed to the completion
of this project:

My Supervisor, Ms. Nimisha Arora: I am immensely grateful for your


guidance, expertise, and constant support throughout the duration of this project. Your
valuable insights and constructive feedback have been instrumental in shaping the
direction and quality of my work.

Faculty Members and Mentors: I extend my sincere appreciation to the faculty


members and mentors who have provided valuable advice, suggestions, and
encouragement during the course of this project. Your expertise and willingness to
share your knowledge have been invaluable in expanding my understanding and
refining my research.

Family and Friends: I would like to thank my family and friends for their
unwavering support, patience, and encouragement. Your belief in me and your
understanding during the challenging moments have been a constant source of
motivation.

Colleagues and Peers: I am grateful to my colleagues and peers for their


collaboration, stimulating discussions, and willingness to share resources. Your
contributions have enriched my research and provided a conducive environment for
growth and learning.

BVP: I am thankful to BVP for providing the necessary resources, facilities,


and funding that made this project possible. Your support has been instrumental in the
successful completion of this endeavour.

[6]
Lastly, I would like to acknowledge all the authors and researchers whose
works have influenced and shaped my understanding in this field. Their
groundbreaking contributions have paved the way for this project and have served as
a source of inspiration throughout.

Thank you to everyone mentioned above and to all those who have played a
part, directly or indirectly, in the completion of this project. Your contributions and
support have been invaluable, and I am truly grateful for the opportunity to work on
this endeavour.

Pradeep Pandey

[7]
CONTENT

CHAPTER 1: INTRODUCTION

1.1 Introduction about Company 10

1.2 Introduction about Project 12

1.3 Present state of the art 13

1.4 Need for Computerization of System 14

1.5 Proposed Software (Objectives and Scope) 16

1.6 Importance of the Work 18

CHAPTER 2: SYSTEM ANALYSIS 20

2.1 Feasibility Study of Software (including its types) 20

2.2 Analysis Methodology (Types) 20

2.3 Choice of Platforms (Software and Hardware) 24

2.3.1 Software used 25

2.3.2 Hardware used 26

CHAPTER 3: SYSTEM DESIGN 27

3.1 Design methodology 27

3.2 Database Design 28

3.3 Screen Design 30

CHAPTER 4: TESTING AND IMPLEMENTATION 33

4.1 Testing Methodology (Types) 33

[8]
4.2 Unit Testing 34

4.3 Module Testing 37

4.4 System Testing 38

4.5 White Box/Black Box Testing 40

4.6 Implementation 43

4.7 Post Implementation 43

CHAPTER 5: CONCLUSION AND REFERENCES 44

5.1 Conclusion 44

5.2 Limitations of the System 45

5.3 Future Scope for Modification 47

5.4.1 Hardware Requirements 50

5.4.2 Software Requirements 51

5.5 References/Bibliography 52

CHAPTER 6: ANNEXURES 53

A-1 Sample Input 53

A-2 Sample Output 55

[9]
CHAPTER 1 INTRODUCTION

1.1 Intro about company

Welcome to Knowledge Academy: Empowering Education for a Brighter Future

At Knowledge Academy, we are passionate about empowering individuals through


quality education. As a leading educational institute, we are dedicated to providing a
wide range of educational services that cater to the diverse learning needs of our
students.

Who We Are:

Knowledge Academy is a dynamic and innovative educational company committed to


fostering a love for learning and personal growth. With a team of experienced
educators and dedicated professionals, we strive to create an environment where
students can thrive academically, intellectually, and emotionally.

Our Vision:

Our vision is to be a catalyst for positive change in the education sector by equipping
students with the knowledge, skills, and values needed to succeed in an ever-changing
world. We aim to nurture a lifelong love for learning and inspire our students to reach
their fullest potential.

Our Programs and Services:

At Knowledge Academy, we offer a comprehensive range of programs and services


designed to meet the educational needs of students at various levels. From early
childhood education to professional development courses, our offerings encompass a
wide range of subjects and disciplines.

[10]
Primary and Secondary Education:

Our primary and secondary education programs provide a strong foundation in core
subjects while encouraging critical thinking, creativity, and personal development.

Test Preparation:

We offer specialized courses to help students prepare for important standardized tests,
including college entrance exams, language proficiency exams, and professional
certifications.

Skill Development:

Our skill development programs focus on enhancing essential skills such as


communication, problem-solving, leadership, and digital literacy, equipping students
with the tools they need to succeed in today's competitive world.

Professional Development:

We provide tailored professional development courses and workshops for educators


and professionals seeking to enhance their knowledge, upgrade their skills, and stay
abreast of the latest trends in their respective fields.

Why Choose Knowledge Academy:

Experienced and Dedicated Faculty: Our team of experienced educators brings


passion, expertise, and a student-centered approach to teaching, ensuring that every
student receives personalized attention and support.

Holistic Approach to Education:


We believe in nurturing the whole person. Our programs integrate academic
excellence with character development, instilling values such as integrity,instilling
values such as integrity, resilience, and social responsibility

[11]
State-of-the-Art Facilities:

Our campuses are equipped with modern facilities, including well-equipped


classrooms, libraries, science laboratories, and technology resources, providing an
optimal learning environment for our students.

Commitment to Excellence:

We maintain high academic standards and continually seek to improve our programs
and services. We are dedicated to providing a challenging and enriching educational
experience that prepares our students for future success.

1.2 Introduction about Project

The Online Voting System is an innovative project developed by me to address the


need for efficient and secure electronic voting. In today's technologically advanced
era, it has become crucial to streamline the voting process and ensure the accuracy of
results. Our system provides a reliable platform for conducting elections
electronically, benefiting various institutions and organizations.

Key Features:

1. User Authentication: The Online Voting System ensures the authenticity of voters
and administrators through a robust username and password verification process. This
step guarantees that only authorized individuals can access the system, maintaining its
integrity.

2. Candidate Registration: Aspiring candidates can register themselves by providing


their necessary information, including their name and identification number. This

[12]
feature offers voters a comprehensive list of candidates, empowering them to make
informed decisions.

3. Secure Vote Casting: Our system enables voters to cast their votes anonymously.
By selecting their preferred candidate from the provided list, voters can submit their
votes with confidence, knowing that their identity will remain confidential. This
ensures the integrity of the electoral process and encourages active participation.

4. Result Calculation: The Online Voting System incorporates an automated result


calculation feature, significantly reducing the time required for compiling and
announcing the voting results. Real-time updates on the number of votes each
candidate has received ensure an efficient and accurate result announcement,
promoting transparency and trust in the system.

5. Administrative Control: Administrators have exclusive control over the system,


allowing them to manage the entire electoral process. They can initiate new elections,
monitor the voting process, review submitted votes, and generate reports. This
administrative control ensures responsible usage and prevents unauthorized access.

1.3 Present state of the art

Before the development of our software, the traditional voting process was
predominantly manual, relying on paper ballots and physical polling stations. This
traditional approach presented several challenges and limitations that needed to be
addressed:

[13]
1. Inefficiency: Manual voting processes often resulted in long queues and delays,
especially during peak voting periods. Voters had to wait in line to cast their votes,
leading to frustration and potential voter discouragement.

2. Errors and Discrepancies: The manual counting and tabulation of paper ballots
were prone to human errors and miscounts. These errors could affect the accuracy and
legitimacy of the election results, raising concerns about fairness and transparency.

3. Accessibility: Physical polling stations limited access to voting for individuals with
mobility issues or those who are absent. This posed a challenge to their democratic
right to participate in the electoral process.

4. Security Risks: Traditional voting methods were susceptible to various security

threats, such as ballot tampering, impersonation, and voter fraud. Ensuring the

integrity of the election process and maintaining the confidentiality of votes was a

significant concern.

1.4 Need of Computerization of System

The development of our software was driven by the need to address several key
challenges and fulfill specific requirements in the voting process. These needs
encompassed various aspects, including efficiency, accessibility, accuracy, security,
and transparency. Here are the primary reasons that led to the creation of our
software:

[14]
1. Enhanced Efficiency: The traditional manual voting process often resulted in long
queues and delays, leading to inefficiencies and voter frustration. By introducing an
online voting system, we aimed to streamline the voting process, reduce waiting
times, and make it more convenient for voters to cast their ballots. The software
enables voters to participate in elections from any location with internet access,
eliminating the need for physical presence at polling stations and reducing the overall
time and effort required for voting.

2. Improved Accessibility: Physical polling stations posed challenges for individuals


with mobility limitations or those residing in remote areas. Our software bridges this
accessibility gap by enabling voters to participate in elections remotely. It ensures that
every eligible voter, regardless of their geographical location or physical abilities, can
exercise their democratic right to vote. This inclusivity promotes a more equitable and
representative democratic process.

3. Accuracy and Reliability: Manual counting and tabulation of paper ballots


introduced the risk of human errors and miscounts. By automating the result
calculation process, our software minimizes the chances of mistakes, ensuring
accurate and reliable election outcomes. The system's built-in checks and balances
further enhance the integrity of the voting process, instilling confidence in the results
among both voters and stakeholders.

4. Security and Trust: Traditional voting methods were susceptible to security risks,
such as ballot tampering, impersonation, and voter fraud. Our software incorporates
robust security measures to safeguard the integrity of the electoral process. User
authentication mechanisms, encryption protocols, and secure data storage ensure that
only authorized individuals can access the system and cast their votes. These security
measures enhance trust and confidence in the voting system, assuring voters that their
votes are protected and counted accurately.

[15]
5. Transparency and Auditability: The online voting system provides a transparent
and auditable process by maintaining a digital trail of votes. This allows for easy
auditing and verification of election results, promoting transparency and
accountability. The software also offers features like digital receipts or confirmation
messages to provide voters with reassurance that their votes have been recorded
correctly.

By addressing these needs and challenges, our software revolutionizes the voting
process, making it more efficient, accessible, secure, accurate, and transparent. It aims
to strengthen democracy by enabling more citizens to participate in elections and
ensuring the integrity of the electoral process.

1.5 Proposed Software

Our software is designed to accomplish several important objectives in the context of


the voting process. By leveraging modern technology and innovative features, it aims
to bring about significant improvements and advancements. Here are some key
accomplishments that our software strives to achieve:

1. Streamlined Voting Process: The software simplifies and streamlines the voting
process, making it more efficient and convenient for both voters and election
administrators. It eliminates the need for physical polling stations and long queues,
allowing voters to cast their ballots from any location with internet access. This saves
time, reduces logistical challenges, and increases voter participation.

2. Increased Accessibility: Our software promotes inclusivity by enhancing


accessibility for all voters. Individuals with mobility limitations or those residing in
remote areas can easily participate in elections through the online platform. This
ensures that every eligible voter has an equal opportunity to exercise their right to
vote, regardless of their geographical location or physical abilities.

[16]
3. Enhanced Accuracy and Reliability: The software utilizes advanced algorithms and
secure data management techniques to ensure accurate and reliable election outcomes.
By automating the vote counting and tabulation process, it minimizes the risk of
human errors and miscounts. This increases the integrity and credibility of the
election results.

4. Strengthened Security Measures: Security is a top priority in our software. It


incorporates robust security measures to protect the integrity of the voting process and
prevent unauthorized access or tampering. User authentication protocols, encryption
techniques, and secure data storage mechanisms safeguard the confidentiality and
privacy of voter information. These security measures instill trust and confidence in
the system, ensuring that the voting process remains secure and tamper-proof.

5. Transparent and Auditable Elections: The software promotes transparency and


auditability in the electoral process. It maintains a digital trail of votes, allowing for
easy auditing and verification of results. This transparency fosters trust among voters,
candidates, and election authorities, ensuring that the outcomes accurately reflect the
will of the electorate.

6. Efficient Result Reporting: Our software enables quick and efficient reporting of
election results. It automates the result calculation process, eliminating the need for
manual tabulation and reducing the time required to announce the outcomes. This
timely reporting enhances the overall efficiency and transparency of the election
process.

7. Data Analysis and Insights: The software provides valuable data analysis and
insights to election administrators and stakeholders. It generates reports and
visualizations that can help identify voting patterns, demographic trends, and other

[17]
relevant information. These insights can assist in making informed decisions and
shaping future electoral strategies.

By accomplishing these objectives, our software revolutionizes the voting process,


making it more accessible, efficient, secure, and transparent. It empowers voters,
strengthens democracy, and ensures that the electoral process remains fair, accurate,
and inclusive.

1.6 Importance of the Work

The work undertaken in developing and implementing our software holds immense
importance in several ways. It addresses critical aspects of the voting process and
contributes to the overall improvement of democratic practices. Here are the key
reasons highlighting the significance of this work:

1. Safeguarding Democracy: Our software plays a crucial role in safeguarding the


democratic principles and values upon which societies are built. By enhancing the
accessibility, accuracy, and transparency of the voting process, it ensures that the will
of the people is accurately reflected in election outcomes. This strengthens the
foundations of democracy and promotes the legitimacy of elected representatives.

2. Ensuring Inclusivity and Accessibility: The software significantly improves the


accessibility of the voting process, allowing individuals from diverse backgrounds
and circumstances to exercise their right to vote. It removes barriers such as
geographical constraints, physical disabilities, or time limitations that may have
previously hindered certain groups from participating fully. This inclusivity ensures
that every eligible citizen has an equal opportunity to have their voice heard and
contribute to the democratic process.

[18]
3. Enhancing Efficiency and Convenience: By digitizing and automating various
aspects of the voting process, our software streamlines operations, saving valuable
time and resources for both voters and election administrators. It eliminates the need
for manual vote counting, reduces administrative burdens, and minimizes the
occurrence of errors or discrepancies. This increased efficiency translates into faster
election results, reduced costs, and improved overall voter experience.

4. Increasing Voter Confidence: The software's robust security measures and


transparent processes foster trust and confidence in the electoral system. Voters can
have peace of mind knowing that their votes are secure, private, and accurately
counted. This trust in the integrity of the voting process is essential for maintaining
public confidence in the democratic system and encouraging active participation in
future elections.

5. Empowering Election Administrators: Our software empowers election


administrators with advanced tools and insights for managing and analyzing electoral
data. It provides them with real-time information, data visualization, and reports that
enable informed decision-making and strategic planning. This empowers
administrators to identify trends, address potential issues, and improve future election
processes.

6. Promoting Global Best Practices: The work on our software aligns with
international efforts to adopt and promote best practices in election management. It
contributes to the ongoing discourse on electoral reforms and the adoption of
technology to enhance the democratic process. By showcasing successful
implementation and positive outcomes, our software can inspire other countries and
jurisdictions to embrace similar innovations, ultimately contributing to the
advancement of democratic practices worldwide.

[19]
CHAPTER 2 SYSTEM ANALYSIS

2.1 Feasibility Study of s/w includes its types

When conducting a feasibility study for software development, several types of


feasibility need to be considered. These feasibility types assess the viability and
practicality of the software project. Here are the common types of feasibility studies
conducted for software:

this software is feasible for Windows and Linux


Can be run in most minimum Hardware specification

2.2 Analysis Methodology

Functional Requirements:

1. User Authentication:

. The program should authenticate the user with a username and password for
accessing the admin panel.

. The program should validate the user ID entered by the student panel.

2. New Election Initialization:

. The program should allow the admin to initiate a new election.

. The admin should provide details such as the election year, branch code, total voters,
and number of candidates.

. The program should create candidate files for storing information about each
candidate.

[20]
3. Continue Previous Election:

. The program should allow the admin to continue with a previous election.

. It should load the election information and candidate details from the saved files.

4. Delete Illegal Vote:

. The program should allow the admin to delete an illegal vote by entering the user ID
associated with the vote.

5. Ban User IDs:

. The program should allow the admin to ban specific user IDs, preventing them from
voting in the election.

6. Result:

. The program should calculate and display the winner of the election based on the
votes received by each candidate.

. It should also display the total number of votes received by each candidate and the
voting percentage.

7. Save Election Information:

[21]
. The program should save the election information, including the current valid user
ID parameters, total voters, and number of candidates, in a file.

8. Save Vote:

. The program should save the vote cast by a student in the candidate's file and update
the vote count for the respective candidate.

Non-Functional Requirements:

1. User Interface:

. The program should provide a user-friendly interface for both students and
administrators.

. It should display clear instructions and options for different functionalities.

2. Security:

. The program should ensure secure authentication for the admin panel to prevent
unauthorized access.

. It should validate user IDs to ensure they match the specified format and branch
code.

. Banned user IDs should be stored securely and not accessible or modifiable by
unauthorized users.

[22]
3. Performance:

. The program should efficiently handle a large number of voters and candidates.

. It should store and retrieve data quickly to provide a seamless user experience.

4. Reliability:

. The program should handle errors and exceptions gracefully to avoid crashes or data
corruption.

. It should save the election information and votes reliably to prevent data loss.

5. Maintainability:

. The code should be well-structured, modular, and easily maintainable.

. It should follow coding best practices and use proper variable and function naming
conventions.

. Comments should be included to explain the purpose and functionality of different


sections of code.

6. Portability:

. The program should be platform-independent and work on different operating


systems without issues.

. It should not rely on any specific hardware or software dependencies.

[23]
2.3 Choice of Platforms s/w & h/w

Software Requirements

The software program you provided appears to be a command-line application written


in C. As such, it can be run on various platforms that support the C programming
language. Some common platforms for running C programs include:

1. Windows: The program can be compiled and run on Windows using an Integrated
Development Environment (IDE) such as Code::Blocks, Dev-C++, or Visual Studio.

2. Linux: C programs can be compiled and run on Linux distributions using the GNU
Compiler Collection (GCC) or Clang. Linux provides a command-line interface
where you can compile and execute the program.

3. macOS: C programs can be compiled and run on macOS using the Xcode
development environment, which includes the Clang compiler. Like Linux, macOS
also provides a command-line interface for compiling and executing C programs.

4. Unix: C programs can be compiled and run on various Unix-based systems, such as
FreeBSD, OpenBSD, and Solaris, using the GCC or Clang compilers.

Hardware Requirements:

The hardware requirements for running a C program depend on the complexity and
resource demands of the program itself. However, for a simple command-line
application written in C, the hardware requirements are generally quite minimal. Here
are the basic hardware requirements:

[24]
1. Processor (CPU): A standard modern processor should be sufficient for running
most C programs. Even a basic processor can handle simple console applications
without any issues.

2. Memory (RAM): The amount of RAM required depends on the size and
complexity of the program and the amount of data it needs to process. For small to
moderate-sized C programs, 2GB to 4GB of RAM should be more than enough.

3. Storage (Hard Drive or SSD): The storage requirements for a C program are
usually minimal. The program itself and any associated files can typically fit within a
few megabytes. A standard hard drive or solid-state drive (SSD) with sufficient free
space should be more than enough.

4. Operating System: C programs can be run on various operating systems, such as


Windows, Linux, macOS, and Unix-based systems. Ensure that your chosen hardware
is compatible with the operating system you plan to use.

5. Input/Output Devices: Since your program is a console-based application, you'll


need a keyboard and a display (such as a monitor or terminal) to interact with the
program and view the output.

2.3.1 Software Used

OS : Windows
Programming Language : C Programming
Code Editor : VS Code
Compiler : gcc

[25]
2.3.2 Hardware Used

Processor : Ryzen 5 5600 h


RAM : 8 GB DDR 4
SSD : 256 GB
HDD : 1 TB
Graphics : 4 GB

[26]
CHAPTER 3 SYSTEM DESIGN

3.1 Design methodology

The above code implements a simple electronic voting system. Here is the design
methodology for the code:

1. Define Data Structures: The code defines two data structures: struct currentValidID
to store the current valid user ID parameters, and typedef struct candidate to represent
a candidate with their ID, name, and votes.

2. Global Variables: Declare global variables to store important information


throughout the program, such as currentValidID for storing the current valid user ID
parameters, candidateArray to store information about all the candidates,
numberOfCandidates to store the total number of candidates, and studentVotes to
store the information of votes given by each student.

3. Helper Functions: Implement helper functions to perform specific tasks, such as


extracting the year from the user ID, extracting the roll number from the user ID,
checking the branch code, authenticating the administrator, banning user IDs, creating
candidate files, deleting illegal votes, getting the winner candidate, initiating a new
election, saving election information in a file, loading election information from a file,
and managing the admin panel.

4. Main Function: Implement the main function, which acts as the entry point of the
program. It provides a menu for the user to choose between the student panel, admin
panel, or exit. Based on the user's choice, it calls the corresponding functions.

[27]
5. Student Panel: In the student panel, the program asks the user to enter their user ID.
It validates the user ID and checks if it is banned or has already voted. If the user ID is
valid and not banned, it displays the list of candidates and asks the user to enter their
vote. The vote is then saved.

6. Admin Panel: In the admin panel, the program asks the administrator to enter their
username and password. It authenticates the administrator and provides options to
initiate a new election, continue a previous election, delete illegal votes, ban user IDs,
display the result, or log out. The corresponding actions are performed based on the
chosen option.

3.2 Database Design

Based on the provided code, the following is a possible database design for storing the
required data:

1. Table: Users

Columns:

. user_id (Primary Key)

. username

. password (hashed and salted)

. is_admin (boolean flag)

2. Table: Elections

Columns:

. election_id (Primary Key)

. year

[28]
. branch_code

. total_voters

3. Table: Candidates

Columns:

. candidate_id (Primary Key)

. election_id (Foreign Key referencing Elections.election_id)

. candidate_name

4. Table: Votes

Columns:

. vote_id (Primary Key)

. election_id (Foreign Key referencing Elections.election_id)

. user_id (Foreign Key referencing Users.user_id)

. candidate_id (Foreign Key referencing Candidates.candidate_id)

5. Table: BannedUsers

Columns:

. banned_id (Primary Key)

. user_id (Foreign Key referencing Users.user_id)

In this design, the Users table stores user information, including their usernames,
hashed passwords, and whether they are administrators or not. The Elections table
holds information about each election, including the year, branch code, and total
number of voters.

[29]
The Candidates table stores candidate information, including their names and the
election they are participating in (referenced through the election_id foreign key). The
Votes table records the votes cast by users, linking the user_id, election_id, and
candidate_id. The BannedUsers table keeps track of banned user IDs.

This database design allows for the storage of user information, election details,
candidate data, and vote records, facilitating the functionality of the code provided.

3.3 Screen Design

The admin panel in the provided software serves as an interface for the administrator
to manage and control the election process. Here is an explanation of the working of
the admin panel:

1 .Authentication:

. The admin is prompted to enter a username and password for authentication.

. The username is compared with "Admin", and the password is compared with
"admiN".

. If the authentication fails, the admin is notified, and access is denied.

. If the authentication succeeds, the admin is granted access to the panel.

2. Menu Options:

. After successful authentication, the admin is presented with several menu options to
choose from.

. The admin can select one of the following options:

[30]
a. New Election: Initiate a new election by entering details such as the year,
branch code, number of candidates, and maximum roll number.

b. Continue Previous Election: Load the information from a previous election


stored in the "ElectionInfo.txt" file.

c. Delete Illegal Vote: Delete a vote associated with a specific user ID.

d. Ban User IDs: Ban specific user IDs by marking them as banned in the
"Banned.txt" file.

e. Result: Display the result of the election, including the winner and the vote
count for each candidate.

f. Logout: Exit the admin panel and return to the main menu.

3. New Election:

. If the admin chooses the "New Election" option, they are prompted to enter the year,
branch code, total number of voters, and the number of candidates.

. The admin can enter the details, which are then saved in the "ElectionInfo.txt" file.

. The admin is also prompted to enter the names of the candidates, and the
information is stored in separate candidate files.

4. Continue Previous Election:

. If the admin chooses the "Continue Previous Election" option, the program loads the
election information from the "ElectionInfo.txt" file.

. The stored information includes the year, branch code, total number of voters, and
the number of candidates.

. The candidate information and the votes cast by students are also loaded from the
respective candidate files.

5. Delete Illegal Vote:

[31]
. If the admin chooses the "Delete Illegal Vote" option, they are prompted to enter a
user ID for which they want to delete the vote.

. The program checks if the user ID is valid and if the corresponding vote exists.

. If both conditions are met, the vote is deleted, and the candidate's vote count is
decremented.

6. Ban User IDs:

. If the admin chooses the "Ban User IDs" option, they can ban specific user IDs by
entering the corresponding roll numbers.

. The banned user IDs are marked with a special character ('$') in the "studentVotes"
array and are stored in the "Banned.txt" file.

7. Result:

. If the admin selects the "Result" option, the program calculates and displays the
election result.

. The candidate with the highest number of votes is declared the winner.

. If there is a tie, the program indicates that it is a tie.

. The program also displays the vote count and percentage for each candidate.

8. Logging Out and Exiting:

. After completing the desired operations, the admin can choose the "Logout" option
to exit the admin panel.

. The program returns to the main menu, where the admin can log in again or exit the
software.

Overall, the admin panel provides functionalities for managing elections, including
initiating new elections, loading previous election data, deleting illegal votes, banning
user IDs, and viewing election results.

[32]
CHAPTER 4 TESTING AND IMPLEMENTATION

4.1 Testing Methodology

1. Open a C compiler or IDE (Integrated Development Environment) such as GCC,


Dev-C++, or Code::Blocks.

2. Create a new C file and copy the provided code into the file.

3. Compile and run the code to ensure there are no syntax errors.

4. Test each function individually by calling them with appropriate parameters and
verifying the results.

. For example, you can test the extractYear function by passing a sample

userID as a parameter and checking if it correctly extracts and returns the year.

. Similarly, you can test other functions such as checkBranchCode, isValid,


isVoted, and isBanned by providing different input values and verifying the
output.

5. Test the program flow and functionality by simulating different scenarios:

. Test the student panel by entering valid and invalid user IDs, checking if the
program correctly validates and processes the zvotes.

[33]
. Test the admin panel by entering the correct username and password, and
then performing actions such as creating a new election, deleting illegal votes,
banning user IDs, and viewing the election results.

6. Ensure that the code handles invalid inputs gracefully and provides appropriate
error messages or prompts for re-entering the data.

7. Verify the file handling operations by checking if files such as "ElectionInfo.txt",


"Banned.txt," and candidate-specific files are created and updated correctly during the
execution of different functions.

8. Perform boundary testing by providing extreme or edge cases as inputs, such as


very large values or empty strings, to ensure the program handles them correctly
without crashing or producing unexpected results.

9. Debug any issues or errors that arise during testing by using printf statements or a
debugger.

10. Repeat the above steps until you are satisfied with the code's performance and
functionality.

4.2 Unit Testing

To perform unit testing on the given code, i followed these steps:

1. Identify the individual functions and code blocks that can be tested separately.

[34]
2. Write test cases for each function, covering different scenarios and edge cases. For
example, test cases can include valid user IDs, invalid user IDs, banned user IDs,
already voted user IDs, etc.

3. Set up the necessary test environment, including any required input files or data.

4. Implement the test cases using a testing framework or manually by calling the
functions with test inputs and checking the expected outputs.

5. Execute the tests and verify that the actual outputs match the expected outputs.

Below is the code for unit testing my program:

#include <stdio.h>

#include <assert.h>

// Function to test

int isValid(char userID[15])

// Implementation of the function

// ...

// Placeholder return value for testing

return 0;

[35]
// Test cases for the isValid function

void testIsValid()

// Test case 1: Valid user ID

char validID1[15] = "2018btecs00001";

assert(isValid(validID1) == 1);

// Test case 2: Invalid user ID (incorrect length)

char invalidID1[15] = "2018btecs001";

assert(isValid(invalidID1) == 0);

// Test case 3: Invalid user ID (incorrect year)

char invalidID2[15] = "2017btecs00001";

assert(isValid(invalidID2) == 0);

// Test case 4: Invalid user ID (incorrect branch code)

char invalidID3[15] = "2018btech00001";

assert(isValid(invalidID3) == 0);

// Test case 5: Invalid user ID (out of range roll number)

char invalidID4[15] = "2018btecs50000";

assert(isValid(invalidID4) == 0);

[36]
// Main test function

int main()

testIsValid();

printf("All tests passed successfully.\n");

return 0;

Similarly, I wrote test cases and performed unit testing for other functions in the code.

4.3 Module Testing

To test the program, I followed these steps:

1. Compiled the code and run the program.

2. Selected the desired option: student panel, admin panel, or exit.

3. If you choose the student panel, enter a valid user ID when prompted.

4. If the user ID is valid, you will see the list of candidates for the election. Enter the
number corresponding to your preferred candidate and press Enter to vote.

5. If you choose the admin panel, enter the username and password when prompted.
The default username is "Admin" and the default password is "admiN".

6. Once logged in as an admin, you can perform various administrative tasks such as
initiating a new election, continuing a previous election, deleting illegal votes,
banning user IDs, checking the election result, or logging out.

I made sure to test different scenarios, such as entering invalid user IDs, voting
multiple times with the same ID, banning IDs, and checking the election result.

[37]
4.4 System Testing

To perform system testing for the given code, you can follow these steps:

1. Compile the code: Use a C compiler to compile the code and generate an
executable file. Make sure to include all the necessary header files and libraries.

2. Execute the program: Run the executable file to start the program. The program
will present a menu with options for the student panel, admin panel, and exit.

3. Student panel testing:

a. Select the student panel option from the menu.

b. Enter a valid user ID and verify that it is accepted.

c. Enter an invalid user ID and verify that it is rejected.

d. Enter a banned user ID and verify that it is rejected.

e. Vote for a candidate and verify that the vote is recorded.

f. Attempt to vote again with the same user ID and verify that it is rejected.

g. Repeat the above steps with different scenarios and inputs to cover all possible
cases.

4. Admin panel testing:

a. Select the admin panel option from the menu.

b. Enter the correct admin username and password and verify that it is accepted.

c. Enter an incorrect admin username and password and verify that it is rejected.

[38]
d. Test the new election initiation functionality:

. Enter the required details for a new election.

. Verify that the election information is saved correctly in the ElectionInfo.txt file.

. Verify that the candidate files are created successfully.

e. Test the continue previous election functionality:

. Ensure that the ElectionInfo.txt file exists with valid information.

. Verify that the election information is loaded correctly from the file.

. Verify that the candidate and vote information is loaded correctly from the candidate
files.

f. Test the delete illegal vote functionality:

. Enter a user ID for a vote that needs to be deleted.

. Verify that the vote is removed from the candidate file and vote count is updated.

g. Test the ban user IDs functionality:

. Enter user IDs to ban.

. Verify that the user IDs are banned and their votes are marked as banned in the
studentVotes array.

h. Test the result functionality:

. Verify that the winner candidate is determined correctly based on the highest vote
count.

. Verify that the overall result and voting percentage are displayed correctly.

i. Test the logout functionality:

. Verify that the admin panel is exited and returned to the main menu.

j. Repeat the above steps with different scenarios and inputs to cover all possible
cases.

[39]
Exit testing:

a. Select the exit option from the main menu.

b. Verify that the program terminates successfully.

During the testing process, make sure to provide different valid and invalid inputs,
test edge cases, and handle any possible exceptions or errors that may occur.

4.5 White Box Black Box Testing

To perform white box and black box testing on this code, we need to consider both
the internal implementation details (white box) and the external functionality (black
box).

White Box Testing:

1. Check the authentication mechanism:

. Test with correct username and password to ensure successful authentication.

. Test with incorrect username and password to ensure unsuccessful authentication.

2. Test the "extractYear" function:

. Pass different user IDs and verify that the extracted year matches the expected year.

3. Test the "extractRollNo" function:

[40]
. Pass different user IDs and verify that the extracted roll number matches the
expected roll number.

4. Test the "checkBranchCode" function:

. Pass different user IDs with matching and non-matching branch codes and ensure the
correct result is returned.

5. Test the "isValid" function:

. Pass different valid and invalid user IDs and verify that the function correctly
identifies them.

6. Test the "isVoted" function:

. Pass user IDs that have voted and those that have not, and verify the correct result is
returned.

7. Test the "isBanned" function:

. Pass user IDs that are banned and those that are not, and verify the correct result is
returned.

8. Test the "saveVote" function:

[41]
. Pass valid user IDs and different vote inputs, and check if the vote is correctly saved
in the candidate file.

Black Box Testing:

1. Test the student panel:

. Enter a valid user ID and ensure that the voting process works correctly.

. Enter an invalid user ID and verify appropriate error messages are displayed.

. Try to vote with a banned user ID and ensure that the system rejects the vote.

2. Test the admin panel:

. Log in as an admin and perform different administrative tasks (e.g., initiating a new
election, banning IDs, deleting votes) to ensure they work as expected.

. Verify that the election results are correctly calculated and displayed.

. Test the option to log out and ensure it works correctly.

3. Test the overall system behavior:

. Perform end-to-end testing by simulating a complete election process with multiple


users and candidates.

. Test boundary cases, such as the maximum number of voters, maximum number of
candidates, etc., to ensure the system handles them correctly.

[42]
4.6 Implementation

We Implemented This software in our company for our collage elections.


Now we have a digitalized programme to eliminate so many hurdles

4.7 Post Implementation

Before Implementing this software, I taught the faculty how to use the
programme and told the head principal Admin panel login info
and about student user id

CHAPTER 5 CONCLUSION AND REFERENCES

[43]
5.1 Conclusion

In conclusion, the implementation of a voting system in a company can greatly


streamline and enhance the voting process, providing a more efficient and transparent
method for decision-making. Throughout our conversation, we discussed the key
features and considerations for implementing such a system.

First and foremost, user authentication is crucial to ensure the security and integrity of
the voting process. Integrating the program with the company's existing authentication
system enables the verification of admin and student credentials.

A user-friendly interface, such as a web application or mobile app, allows easy access
and interaction with the voting system. This enhances the user experience and
encourages participation.

Database integration provides a robust and scalable solution for storing and retrieving
data related to candidates, votes, and user information. This ensures efficient data
management and facilitates reporting and analytics.

To ensure the confidentiality and integrity of the voting system, security measures
such as data encryption, protection against security vulnerabilities, and access controls
should be implemented.

Integration with other systems, such as HR or messaging systems, can enhance the
functionality and efficiency of the voting system by leveraging existing infrastructure
and automating processes.

[44]
Considering scalability and performance is essential, particularly if the company
expects a high volume of users or future growth. Designing the program to handle
increased traffic and optimize performance ensures a smooth user experience.

Compliance with legal and regulatory requirements, such as data privacy and voting
procedures, is paramount. Adhering to relevant laws ensures the protection of
personal data and the anonymity of votes.

Thorough testing and quality assurance are critical to identify and address any issues
or bugs before the system is deployed. This ensures the program functions as intended
and provides a reliable voting solution.

Lastly, ongoing maintenance and support are necessary to address any future issues,
perform updates, and provide technical assistance to users.

By implementing a comprehensive voting system that incorporates these


considerations, companies can create a transparent, efficient, and secure environment
for conducting voting processes. Such a system not only streamlines decision-making
but also promotes employee engagement and enhances the overall democratic process
within the organization.

5.2 Limitation of System

While implementing a voting system in a company can bring numerous benefits, it is


essential to be aware of potential limitations and challenges. Here are some common
limitations of such systems:

[45]
1. Technical Challenges: Voting systems rely heavily on technology, and technical
issues such as system failures, network interruptions, or software bugs can disrupt the
voting process and undermine its reliability.

2. Security Risks: Despite implementing security measures, there is always a risk of


unauthorized access, hacking, or tampering with the voting system. Ensuring robust
security protocols and regular audits is crucial to mitigate these risks.

3. User Adoption: Introducing a new voting system requires user adoption and
acceptance. Some employees may be resistant to change or unfamiliar with
technology, leading to lower participation rates and potentially biased results.

4. Accessibility and Inclusivity: It's important to ensure that the voting system is
accessible to all employees, including those with disabilities or limited technology
skills. Providing alternative voting methods or accommodations can help address
these concerns.

5. Privacy Concerns: Employees may have concerns about the privacy of their votes
and personal information. Clear communication and transparency regarding data
handling and anonymization measures can help alleviate these concerns.

6. Cost and Resource Allocation: Implementing and maintaining a robust voting


system can involve significant costs, including software development, hardware
infrastructure, security measures, and ongoing maintenance. Adequate resource
allocation and budget planning are crucial to sustain the system effectively.

7. Legal and Regulatory Compliance: Voting systems must comply with relevant legal
and regulatory requirements, including data protection laws and internal company

[46]
policies. Staying up to date with these regulations and ensuring compliance can be
challenging, particularly in a dynamic regulatory landscape.

8. Voter Authentication: While authentication is crucial for system security, it can


pose challenges in terms of user convenience and ease of access. Striking a balance
between security and user experience is important to encourage participation.

9. System Scalability: As the company grows or the number of voters increases, the
system should be able to handle a higher volume of traffic and scale accordingly.
Scalability challenges can arise if the system was not designed with future growth in
mind.

10. Training and Support: Providing adequate training and support to users, including
employees and administrators, is essential for effective utilization of the voting
system. Lack of training or support can lead to confusion, reduced engagement, and
potential misuse of the system.

By being aware of these limitations, organizations can proactively address them and
implement measures to mitigate potential risks. Regular evaluation and continuous
improvement of the voting system can help overcome these challenges and ensure its
successful implementation within the company.

5.3 Future Scope of Modification

The future scope for modification of a voting system in a company can be diverse and
extensive. Here are some potential areas for improvement and development:

1. Enhanced Security Measures: As technology advances and new security threats


emerge, there is always room for improving the security measures of a voting system.

[47]
This can include implementing stronger encryption algorithms, adopting multi-factor
authentication, conducting regular security audits, and staying updated with the latest
security practices to ensure the integrity of the voting process.

2. Blockchain Integration: Blockchain technology offers a decentralized and


transparent approach to voting, providing an immutable and tamper-resistant ledger.
Integrating blockchain into the voting system can enhance security, transparency, and
trust, ensuring that votes are accurately recorded and protected from manipulation.

3. Mobile and Remote Voting: With the increasing prevalence of remote work and the
widespread use of smartphones, the ability to vote remotely using mobile devices can
improve accessibility and convenience for employees. Developing mobile
applications or web-based interfaces that allow employees to securely cast their votes
from anywhere can enhance participation rates and streamline the voting process.

4. Data Analytics and Reporting: Implementing advanced data analytics capabilities


can provide valuable insights into voting patterns, trends, and employee sentiments.
Analyzing this data can help organizations make informed decisions, identify areas
for improvement, and gain a better understanding of employee preferences and
concerns.

5. Integration with Collaboration Tools: Integrating the voting system with existing
collaboration tools and platforms used within the company, such as project
management software or intranet portals, can streamline the voting process. This
integration can facilitate seamless communication, notification of upcoming votes,
and easy access to voting information, increasing engagement and participation.

6. Accessibility Features: Continuing to improve the accessibility features of the


system can ensure that employees with disabilities or diverse needs can participate
fully in the voting process. This may involve incorporating features such as text-to-

[48]
speech, screen readers, and customizable interfaces to accommodate different
accessibility requirements.

7. Real-time Results and Notifications: Providing real-time updates on voting results


and notifying participants about the progress of the voting process can enhance
transparency and engagement. This can be achieved through instant notifications,
dashboards, or even live vote tracking, allowing employees to stay informed and
actively participate throughout the voting period.

8. Integration with HR and Feedback Systems: Linking the voting system with HR
processes and feedback mechanisms can enable organizations to gather employee
feedback on specific policies, initiatives, or changes. This integration can facilitate a
holistic approach to decision-making, ensuring that employee opinions are considered
in key organizational matters.

9. Continuous User Feedback and Iterative Improvements: Regularly seeking


feedback from users and stakeholders, such as employees and administrators, can
provide valuable insights for further system enhancements. Conducting user surveys,
focus groups, or usability testing sessions can help identify pain points, usability
issues, and areas where the system can be modified to better meet user needs.

10. Integration of Artificial Intelligence (AI): Leveraging AI capabilities, such as


natural language processing and sentiment analysis, can enable the system to
automatically analyze employee comments, suggestions, or open-ended responses. AI
can help extract valuable insights from unstructured data and assist in decision-
making processes.

By exploring these future scope areas for modification, organizations can adapt and
evolve their voting systems to meet the changing needs and expectations of
employees, enhance user experience, and ensure the effectiveness of the system in

[49]
driving transparent and inclusive decision-making processes.

5.4.1 H/W Requirements

The hardware requirements for running a C program depend on the complexity and
resource demands of the program itself. However, for a simple command-line
application written in C, the hardware requirements are generally quite minimal. Here
are the basic hardware requirements:

1. Processor (CPU): A standard modern processor should be sufficient for running


most C programs. Even a basic processor can handle simple console applications
without any issues.

2. Memory (RAM): The amount of RAM required depends on the size and
complexity of the program and the amount of data it needs to process. For small to
moderate-sized C programs, 2GB to 4GB of RAM should be more than enough.

3. Storage (Hard Drive or SSD): The storage requirements for a C program are
usually minimal. The program itself and any associated files can typically fit within a
few megabytes. A standard hard drive or solid-state drive (SSD) with sufficient free
space should be more than enough.

4. Input/Output Devices: Since your program is a console-based application, you'll


need a keyboard and a display (such as a monitor or terminal) to interact with the
program and view the output.

5.4.2 S/W Requirements

[50]
The software program you provided appears to be a command-line application written
in C. As such, it can be run on various platforms that support the C programming
language. Some common platforms for running C programs include:

1. Windows: The program can be compiled and run on Windows using an Integrated
Development Environment (IDE) such as Code::Blocks, Dev-C++, or Visual Studio.

2. Linux: C programs can be compiled and run on Linux distributions using the GNU
Compiler Collection (GCC) or Clang. Linux provides a command-line interface
where you can compile and execute the program.

3. macOS: C programs can be compiled and run on macOS using the Xcode
development environment, which includes the Clang compiler. Like Linux, macOS
also provides a command-line interface for compiling and executing C programs.

4. Unix: C programs can be compiled and run on various Unix-based systems, such as
FreeBSD, OpenBSD, and Solaris, using the GCC or Clang compilers.

5.5 Bibliography

[51]
 Senior Mr. Aman
 Educative/System design
 Indeed/Methodologies
 Indeed/Software Implementation
 GeeksforGeeks

CHAPTER 6 ANNEXURES

[52]
A-1 Sample Input
1

2018btecs00064

2018

btecs

Candidate1

Candidate2

Candidate3

Candidate4

Candidate5

[53]
Admin Panel

Student Panel

[54]
A-2 Sample Output

To exit press 0

Enter user ID: 2018btecs00064

Candidates for election:

1. Candidate1

2. Candidate2

3. Candidate3

4. Candidate4

5. Candidate5

Your Vote(Enter Number): 3

Thanks for your precious vote(Press Enter)

[55]

You might also like