100% found this document useful (1 vote)
379 views64 pages

Online Voting System

This chapter introduces the background and context of the study. It discusses how the current voting system used in student union governments (SUGs) is inefficient, with slow voter registration, manual vote counting prone to manipulation, and inaccessible polling stations. The aim of the study is to develop an online campus voting system to address these issues and increase voter participation. Key objectives are to review related work, develop a software platform for online voting and results, and compare the system to other methods. The significance of the study is that an online system could make elections more efficient, reduce costs for SUGs and society, and help promote fair and credible elections.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
379 views64 pages

Online Voting System

This chapter introduces the background and context of the study. It discusses how the current voting system used in student union governments (SUGs) is inefficient, with slow voter registration, manual vote counting prone to manipulation, and inaccessible polling stations. The aim of the study is to develop an online campus voting system to address these issues and increase voter participation. Key objectives are to review related work, develop a software platform for online voting and results, and compare the system to other methods. The significance of the study is that an online system could make elections more efficient, reduce costs for SUGs and society, and help promote fair and credible elections.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 64

CHAPTER ONE

INTRODUCTION

1.1 BACKGROUND OF THE STUDY

In every democratic setting with persons of differing and inconsistent opinions, decisions
must be made between several options. This happens in business environment, educational
environment, social organizations, and mostly in governance. One of the ways of making
such a decision is through voting. Voting is a formal process of expressing individual
opinions for or against some motion. In the governance sector of many organization this
process is always used as a means of selecting or electing a leader. One of the key areas
where voting is applied is in election. Election is the formal process of selecting a person for
public office or of accepting or rejecting a political proposition by voting.

Online voting (Electronic Voting) as a term encompasses a broad range of voting systems
that apply electronic elements in one or more steps of the electoral cycle. There are many
levels to online voting in a broad sense which could be e-collation, e-verification and internet
voting, remote online voting etc. Following the definition of a system as anything that takes
an input and gives an output, an online voting system is any system that can offers both
electronic and online voting. It could also incorporate e- registration, e-verification, e-
collation, remote online voting and real-time result display. An Online voting system
generally comprises the following for it to work efficiently:
i. An interactive voting user interface on an electronic device which provides a
friendly environment for voters to authenticate and cast their votes, it also serves as a means
of collection of the individual votes and storing them in the local and central database.
ii. An administrative dashboard for voters’ registration, details update and elections
coordination and monitoring.

iii. A database management system for the storage of election, voting and voters data.

iv. A result display interface.

Online voting system serves to reduce the cumulative costs of running elections and increases
students voting participation in election system as it offers voters an easy and convenient way
to vote and most importantly, it is a panacea to the issue of ballot box snatching which is
rampart in the conventional election process in SUG’s.

1
A great technological improvement is observed in election process mostly in the areas of
result collation and transmission. Though the SUG electoral body has not fully implemented
the use of technologies for collation due to lack of legal framework. But, most elections
around the world use ICT in elections to some degree, at least to summarize and aggregate
the votes. This electronic adaptation is the result of a long period of evolution during which
not only the procedures but also the technological means for casting votes changed
considerably.

1.2 PROBLEM STATEMENT

The present voting system applicable in the SUG electoral system has proved inefficient as
the voters’ registration process is slow, the manual collation of results takes time and gives
room for result manipulation, also the inaccessible nature of election venues which includes
the long distances to be covered by voters’ to their registered location increases voters’
apathy towards the election processes, and finally the issues of ballot box snatching and
damage, and other election violence and issues associated with the traditional ballot paper
voting all defiles the purpose of voting in election process as a formal process of expressing
individual opinions for or against some motion.

1.3 AIM AND OBJECTIVES


The aim of this project is to Computerized Online Campus Voting System

The Objectives are as follows;

1. To review a related work.

2. To develop a software platform for voter’s registration, election voting, real-time


election results collation and monitoring and mostly for voters’ remote access to
elections.
3. To develop an administration dashboard for the election administrators.

4. To simulate and compare the results of the designed online voting system and
other voting systems.

2
1.4 SIGNIFICANCE OF THE STUDY

In view of the rapid development of computer technology in virtually all fields of operation
and its use in relation to information management, the importance of the online voting system
are as follows:

1. To the Polytechnic

An online voting system is beneficial to the polytechnic as:

i. It will provide a means t o conduct a more or less stressful and fair elections at
different levels ( faculty, departments, school wide etc.) in the polytechnic.
ii. It will offer an in-depth knowledge of the practical approach to ICT education.

iii. It will serve as a hands-on application of theories taught in class as it relates to


database, software and hardware development.
iv. As its’ database is based on a flexible database management system, student and
staff details can easily be collected for easy access and monitoring.
v. Its’ smart card system can also be applied to other fields (e.g. networking) for easy
access of each individuals’ data.
vi. It will serve as a base for other works in the field of ICT in governance.

2. To the Society

The significance of an online voting system to the society and mostly to SUG are itemized as
follows:

i. It will provide INEC (Independent National Electoral Commission) with a means


to conduct less costly and fair elections.
ii. The secure and flexible database management system safeguards data and
information to account for credible elections.
iii. It will serve to reduce the workload in the process of conducting election.

iv. As it incorporates remote voting individuals can vote from their convenience.

v. It will enable INEC reduce the time wasted in collating and announcing election result.

vi. It will greatly reduce and eliminate disenfranchising electorates.

vii. It will serve to eliminate invalid votes, curb election violence as votes are counted
immediately as they are cast.

3
1.5 SCOPE OF THE STUDY

This project work is mainly designed to enable the SUG electoral body to use electronic device to
capture voter’s information, and to allow voters to their cast votes easily and comfortably to promote a
more credible election which is efficient and less costly. The dynamic nature of the elections
application interface and database structure allows for different organizations set up and conduct
basic elections too. Its online interface enables real-time election monitoring and result collation.

1.6 LIMITATIONS OF THE STUDY

The limitation of the study are as follows;


1. It requires network access: Since the collection and sending of votes to the database requires
an internet access which may not be readily available in some urban area would seem a limiting
factor, though the local database and the printed vote can be used for counting until network is
restored.
2. The cost of setting up an online voting system is high: Due to the delicate nature of such a
system and the fact that its’ major components are presently not locally source, it would be
quite costly to setup, but its usage and maintenance cost is far better than the present ballot
paper system.

1.7 DEFINITION OF TERMS


i. Voting: It is a formal process of expressing individual opinions for or against some motion.
ii. Online voting (Electronic Voting): as a term encompasses a broad range of voting systems
that apply electronic elements in one or more steps of the electoral cycle.

iii. Data Base Management System (DBMS): It is a software system that is used to create,
maintain, and provide controlled access to user databases.
iv. Database: It is an organized collection of logically related data, usually designed to meet
the information needs of multiple users in an organization.
v. Data and database administrators: Data administrators are persons who are responsible
for the overall management of data resources in an organization.
vi. User interface: This includes languages, menus, and other facilities by which users interact
with various system components, such as CASE tools, application programs, the DBMS, and
the repository.
vii. System developers: They are persons such as systems analysts and programmers who
design new application programs.

4
viii. Network: A network consists of two or more computers that are linked in order to share
resources (such as printers and CDs), exchange files, or allow electronic communications.
The computers on a network may be linked through cables, telephone lines, radio waves,
satellites, or infrared light beams.
ix. Internet: The Internet is the global system of interconnected computer networks that uses
the Internet Protocol Suite (TCP/IP) to communicate between networks and devices.
x. Computer: A computer is a digital electronic machine that can be programmed to carry out
sequences of arithmetic or logical operations automatically.
xi. Web Dashboard: A web dashboard is an online interface, or page in your website, that
displays real-time data as insightful charts and reports.
xii. Website: A website is a collection of web pages and related content that is identified by a
common domain name and published on at least one web server. Examples of notable
websites are Google, Facebook, Amazon, and Wikipedia.
xiii. Webpage: A web page is a hypertext document on the World Wide Web. Web pages are
delivered by a web server to the user and displayed in a web browser.
xiv. Personal Website: Personal websites are for individuals who want to have an online
presence to voice their opinion, help with job prospects, or establish their own personal
brand. Most personal websites are fairly simple, with images and a lot of text.
xv. Blog Website: A blog website is regularly updated with relevant articles, videos, and photos
meant to inform, entertain, and educate your audience
xvi. Browser: A web browser (also referred to as an Internet browser or simply a browser) is
application software for accessing the World Wide Web or a local website.
xvii.HTTP: The abbreviation for Hypertext Transfer Protocol. It is the set of rules by which
Web pages are transferred across the Internet.
xviii. Homepage: It is the first page that is viewed when the browser starts. It is also the page of
a web site that provides the introduction or content with links
xix. TelNet: A terminal emulation protocol (or Internet program) used to connect a computer to
a remote host or server. Telnet is one of the oldest Internet activities and is primarily used to
access online databases or to read articles stored on university servers.
xx. Internet Protocol (IP): A terminal emulation protocol (or Internet program) used to connect
a computer to a remote host or server. Telnet is one of the oldest Internet activities and is
primarily used to access online databases or to read articles stored on university servers.

5
CHAPTER TWO
LITERATURE REVIEW

2.1 THEORY

Online voting (also known as e-voting) is voting that uses electronic means to either aid or take care
of casting and counting ballots. Depending on the particular implementation, e-voting may use
standalone electronic voting machines (also called EVM) or computers connected to the Internet. It
may encompass a range of Internet services, from basic transmission of tabulated results to full-
function online voting through common connectable household devices. The degree
of automation may be limited to marking a paper ballot, or may be a comprehensive system of vote
input, vote recording, data encryption and transmission to servers, and consolidation and tabulation
of election results. A worthy E-voting system must perform most of these tasks while complying
with a set of standards established by regulatory bodies, and must also be capable to deal
successfully with strong requirements associated with security, accuracy, integrity, swiftness,
privacy, auditability, accessibility, cost-effectiveness, scalability and ecological sustainability.

2.1.1 PROTOTYPE TOOLS


We made the prototype by using the tools below:
1. MySQL DBMS: It permits combination, extraction, manipulation, and organization of knowledge
within the voter’s info. Its platform is freelance and thus may be enforced and used across many
like Windows, Linux servers and is compatible with varied hardware mainframes. It is quick in
performance, stable, and provides business price at a coffee price.
2. XAMPP Server: XAMPP helps an area host or server to check its website and purchasers via
computers and laptops before emotional it to the most server. It is a platform that furnishes an
appropriate setting to check and verify the operating of comes supported Apache, Perl, MySQL
info, and PHP through the system of the host itself.

2.1.2 DATABASE TECHNOLOGIES

At the heart of every fully designed system are the collection, storage, aggregation, manipulation,
dissemination, and management of data. Data are raw facts. The word raw indicates that the facts have
not yet been processed to reveal their meaning. Information are data that have been processed in such
a way that the knowledge of the person who uses the data is increased. These facts are made available
for processing because they are stored at a place for future reference. The two main techniques for data
storage in computers are: file system and database.

6
A file system is a method for storing and organizing computer files and the data they contain to make it
easy to find and access them. File systems may use a storage device such as a hard disk or CD-ROM
and involve maintaining the physical location of the files. The file system can be used to store less
complex data, but in a case of an organizations’ data which includes employee details, financial records
and so on, a well-structured system is required for such task and such a system is referred to as a
database.

Database is as an organized collection of logically related data. It is a collection of data, typically


describing the activities of one or more related organizations. A database can also be seen as a shared,
integrated computer structure that stores a collection of:

◆ End-user data, that is, raw facts of interest to the end user.

◆ Metadata, or data about data, through which the end-user data are integrated and managed.

The file systems became obsolete as their integration and use becomes difficult when the volume of
data stored increases. Its numerous disadvantages led to the development of database as an easier
means for data storage, but as the need for a good data manipulation system increased, there was need
to develop a management system for databases for quick access and control and that gave rise to the
Database Management System (DBMS).

2.1.2.1 COMPONENTS OF THE DATABASE ENVIRONMENT

The database operational environment is an integrated system of hardware, software, and people,
designed to facilitate the storage, retrieval, and control of the information-resource and to improve the
productivity of the organization. They include:

7
Figure 2.1: Components of the Database Environment.

Computer-aided software engineering (CASE) tools: CASE tools are automated tools used to design
databases and application programs.

Repository: A repository contains an extended set of metadata important for managing databases as
well as other components of an information system.

DBMS: It is a software system that is used to create, maintain, and provide controlled access to user
databases.

Database: It is an organized collection of logically related data, usually designed to meet the
information needs of multiple users in an organization. It is important to distinguish between the
database and the repository. The repository contains definitions of data, whereas the database contains
occurrences of data.

Application programs: Computer-based application programs are used to create and maintain the
database and provide information to users.

User interface: This includes languages, menus, and other facilities by which users interact with
various system components, such as CASE tools, application programs, the DBMS, and the repository.

Data and database administrators: Data administrators are persons who are responsible for the
overall management of data resources in an organization. Database administrators are responsible for
physical database design and for managing technical issues in the database environment.

System developers: They are persons such as systems analysts and programmers who design new
application programs. System developers often use CASE tools for system requirements analysis and
program design.

End users: These are persons throughout the organization who add, delete, and modify data in the
database and who request or receive information from it. All user interactions with the database must
be routed through the DBMS.

2.1.3 DATABASE MANAGEMENT SYSTEM

A database management system (DBMS) is a software system that enables the use of a database. The
primary purpose of a DBMS is to provide a systematic method of creating, updating, storing, and
retrieving the data stored in a database. It enables end users and application programmers to share data,
and it enables data to be shared among multiple applications rather than propagated and stored in new
files for every new application. A DBMS also provides facilities for controlling data access, enforcing
data integrity, managing concurrency control, and restoring a database.
8
There are many terms associated with the DBMS used to explain the different operations in a database
environment, they include terms like query -- a specific request issued to the DBMS for data
manipulation — for example, to read or update the data. Simply put, a query is a question.

The terms database and DBMS are most times used interchangeably to refer to the database technology
and as such we adopt such use here to us focus on the technological aspects of the database approach.

2.1.3.1 ADVANTAGES OF DATABASE

As a database is only as useful as its DBMS, the advantages of a DBMS are as follows:

1. Improved data sharing: The DBMS helps create an environment in which end users have
better access to more and better-managed data. Such access makes it possible for end users to
respond quickly to changes in their environment.

2. Improved data security: The more users access the data, the greater the risks of data security
breaches. Corporations invest considerable amounts of time, effort, and money to ensure that
corporate data are used properly. A DBMS provides a framework for better enforcement of data
privacy and security policies.

3. Better data integration: Wider access to well-managed data promotes an integrated view of
the organization’s operations and a clearer view of the big picture. It becomes much easier to
see how actions in one segment of the organization affect other segments.

4. Minimized data inconsistency: Data inconsistency exists when different versions of the same
data appear in different places. For example, data inconsistency exists when a company’s sales
department stores a sales representative’s name as “MaryJabe” and the company’s personnel
department stores that same person’s name as “Mary-Jane C.,” or when the company’s regional
sales office shows the price of a product as #4,500 and its national sales office shows the same
product’s price as #4,490. The probability of data inconsistency is greatly reduced in a properly
designed database.

5. Improved data access: The DBMS makes it possible to produce quick answers to ad hoc
queries - a spur-of-the-moment question. The DBMS sends back an answer (called the query result set)
to the application. For example, end users, when dealing with elections data, might want quick answers
to questions (ad hoc queries) such as:

◆ What was the total number of registered voters during the past six months?

◆ What is the total number of students who can vote?

9
◆ How many candidates are contesting for a particular election?

6. Improved decision making. Better-managed data and improved data access make it possible to
generate better-quality information, on which better decisions are based. The quality of the
information generated depends on the quality of the underlying data. Data quality is a
comprehensive approach to promoting the accuracy, validity, and timeliness of the data. While
the DBMS does not guarantee data quality, it provides a framework to facilitate data quality
initiatives.

7. Increased end-user productivity: The availability of data, combined with the tools that
transform data into usable information, empowers end users to make quick, informed decisions
that can make the difference between success and failure in the global economy.
8. Improved data independence: Application programs should be as independent as possible from
details of data representation and storage. The DBMS can provide an abstract view of the data
to insulate application code from such details.

2.1.3.2 DISADVANTAGES OF DATABASE

The database approach entails some additional costs and risks that must be recognized and managed
when it is implemented.

1. Need for new, specialized personnel: Frequently, organizations that adopt the database
approach need to hire or train individuals to design and implement databases, provide database
administration services, and manage a staff of new people.

2. Installation and management cost and complexity: Installing such a system may also require
upgrades to the hardware and data communications systems in the organization. Substantial
training is normally required on an ongoing basis to keep up with new releases and upgrades.
Additional or more sophisticated and costly database software may be needed to provide
security and to ensure proper concurrent updating of shared data.

3. Conversion costs: The cost of converting these older systems to modern database technology
measured in terms of money, time, and organizational commitment may often seem prohibitive
to an organization.

4. Need for explicit backup and recovery: This requires that comprehensive procedures be
developed and used for providing backup copies of data and for restoring a database when
damage occurs.

5. Organizational conflict: Experience has shown that conflicts on data definitions, data formats
and coding, rights to update shared data, and associated issues are frequent and often difficult to
resolve.
10
11
2.1.4 TYPES OF DATABASE

Depending upon the usage requirements, there are following types of databases available:

1. Centralized database: The information (data) is stored at a centralized location and the
users from different locations can access this data. This type of database contains application
procedures that help the users to access the data even from a remote location. Various kinds of
authentication procedures are applied for the verification and validation of end users, likewise, a
registration number is provided by the application procedures which keeps a track and record of
data usage.

2 . Distributed database: The data is not at one place and is distributed at various sites of an
organization. These sites are connected to each other with the help of communication links
which helps them to access the distributed data easily.

There are two kinds of distributed database, viz. homogeneous and heterogeneous. The databases
which have same underlying hardware and run over same operating systems and application procedures
are known as homogeneous DDB. Whereas, the operating systems, underlying hardware as well as
application procedures can be different at various sites of a DDB which is known as heterogeneous
DDB.

3. Personal database: Data is collected and stored on personal computers which is small and
easily manageable. The data is generally used by the same department of an organization and is
accessed by a small group of people.

4. End-user database: The end user is usually not concerned about the transaction or operations
done at various levels and is only aware of the product which may be a software or an
application. Therefore, this is a shared database which is specifically designed for the end user,
just like different levels’ managers. Summary of whole information is collected in this database.

5. Commercial database: These are the paid versions of the huge databases designed uniquely
for the users who want to access the information for help. These databases are subject specific,
and one cannot afford to maintain such a huge information.

6. NoSQL database: These are used for large sets of distributed data. There are some big data
performance issues which are effectively handled by relational databases, such kind of issues
are easily managed by NoSQL databases. There are very efficient in analyzing large size
unstructured data that may be stored at multiple virtual servers of the cloud. An example of a
NoSQL database is MongoDB.

7. Operational database: Information related to operations of an enterprise is stored inside this


database. Functional lines like marketing, employee relations, customer service etc. require
12
such kind of databases.

8. Relational database: These databases are categorized by a set of tables where data gets fit into
a predefined category. The table consists of rows and columns where the column has an entry
for data for a specific category and rows contains instance for that data defined according to the
category.
There are various simple operations that can be applied over the table which makes these databases
easier to extend, join two databases with a common relation and modify all existing applications.

9. Cloud database: Now a day, data has been specifically getting stored over clouds also known
as a virtual environment, either in a hybrid cloud, public or private cloud. A cloud database is a
database that has been optimized or built for such a virtualized environment.

There are various benefits of a cloud database, some of which are the ability to pay for storage
capacity and bandwidth on a per-user basis, and they provide scalability on demand, along with
high availability.

A cloud database also gives enterprises the opportunity to support business applications in a
software-as-a-service deployment.

10. Object-oriented database: An object-oriented database is a collection of object-oriented


programming and relational database. There are various items which are created using object-
oriented programming languages like C++, Java which can be stored in relational databases, but
object-oriented databases are well-suited for those items.

An object-oriented database is organized around objects rather than actions, and data rather than
logic. For example, a multimedia record in a relational database can be a definable data object,
as opposed to an alphanumeric value.

11. Graph database: The graph is a collection of nodes and edges where each node is used to
represent an entity and each edge describes the relationship between entities. A graph-oriented
database, or graph database, is a type of NoSQL database that uses graph theory to store, map
and query relationships. Graph databases are basically used for analyzing interconnections. For
example, companies might use a graph database to mine data about customers from social
media.

2.1.5 MONGODB DBMS

MongoDB is not only a general-purpose database which can perform only insert, update and delete data
within it. Besides these, there are several important features which make the MongoDB one of the most
popular and enriched databases in the world of NoSQL databases. Some of the features are as below;

13
14
1. MongoDB supports JSON data models with dynamic schema.

2. In MongoDB, we can perform a search on any field or any range query and also can use a
regular expression for searching the data MongoDB supports secondary indexes which allow us
to search a variety of data in a very small time-span. It also provides us with different types of
indexes like unique index, compound index, geospatial index etc.

3. MongoDB supports aggregation pipeline which helps us to build complex aggregations to


optimize the database.

4. MongoDB supports Master-Slave replication.

5. MongoDB support automatic load balancing features.

6. MongoDB supports auto-sharding for horizontal scaling.

7. MongoDB can store any type of file which can be any size without affecting our stack.

8. MongoDB basically use JavaScript objects in place of the procedure.

9. MongoDB supports special collection type like TTL (Time-To-Live) for data storage which
expires at a certain time.

MongoDB supports all types of operating systems. MongoDB is available in two versions –
Community Server Edition (Perfect of Self Use or Developer Mode) and Enterprise Server Edition (For
Business Purpose Use with Proper Licensing). The MongoDB installer is available for all types of
operating systems like Windows, Linux or Mac OS. Installer for MongoDB can be downloaded from
the MongoDB sites.

2.1.6 WEBSITE AND WEBPAGE

A website is a collection of web pages and related content that is identified by a common domain


name and published on at least one web server. Examples of notable websites
are Google, Facebook, Amazon, and Wikipedia.

All publicly accessible websites collectively constitute the World Wide Web. There are also private
websites that can only be accessed on a private network, such as a company's internal website for its
employees.

Websites are typically dedicated to a particular topic or purpose, such as news, education, commerce,
entertainment, or social networking. Hyperlinking between web pages guides the navigation of the
site, which often starts with a home page.
15
Users can access websites on a range of devices, including desktops, laptops, tablets,
and smartphones. The app used on these devices is called a web browser.

Webpage: A web page is a hypertext document on the World Wide Web. Web pages are delivered by
a web server to the user and displayed in a web browser.  A website consists of many web
pages linked together under a common domain name. The name "web page" is a metaphor of paper
pages bound together into a book.

The core element of a web page is a text file written in the Hypertext Markup Language (HTML) that
describes the content of the web page and includes references to other web resources. A web page is
a structured document that primarily consists of hypertext, text with hyperlinks. Hyperlinks point the
user to other web resources, primarily other web pages, and to different sections of the same web
page. Multimedia content on the web, such as images, videos, and other web pages, can be directly
embedded in a web page to form a compound document.

2.1.6.1 TYPES OF WEBSITES

1. E-commerce Websites: Ecommerce websites allow users to shop for and purchase products or
services online. Amazon, Bookshop, and other retailers that sell products through an online store
are great examples of ecommerce sites. These websites make it easy to drop items in your cart and
checkout using your credit card, a payment service like PayPal or an ecommerce platform like
Shopify.

2. Personal Websites: Personal websites are for individuals who want to have an online presence to
voice their opinion, help with job prospects, or establish their own personal brand. Most personal
websites are fairly simple, with images and a lot of text. Since personal websites are shared with
friends, family, and colleagues manually, they don't typically require any lead generation tools or
SEO. However, if you plan to use your own website to promote yourself as a professional, it
certainly doesn't hurt to optimize your content to appear in search engines.

3. Portfolio Websites: While similar to a personal site, this type of website is all about showcasing
your professional work with the goal of winning clients. A portfolio website is a canvas for
designers, writers, videographers, artists, and other creative professionals. These types of websites
exist to highlight specific skill sets and services that free lancers offer.

4. Business Website: A business website provides an online presence so people can learn about a
company, its employees, products, services, and culture. The goal of a small business website is to
provide information so customers can reach you directly. Examples include local accounting
firms, service providers (plumbers, HVAC, etc.), restaurants, and law offices.

16
6. Blog Website: A blog website is regularly updated with relevant articles, videos, and photos
meant to inform, entertain, and educate your audience. Blogs are sometimes platforms to voice
an individual's opinion, or a company may have one to offer valuable content to their
customers. These types of websites can either put the main focus on the blog itself — centering
the site around the regularly updated content — or be built into a larger website.  

2.1.7 BROWSER

A web browser (also referred to as an Internet browser or simply a browser) is application software for


accessing the World Wide Web or a local website. When a user requests a web page from a
particular website, the web browser retrieves the necessary content from a web server and then displays
the page on the user's device.

A web browser is not the same thing as a search engine, though the two are often confused. A search
engine is a website that provides links to other websites. However, to connect to a website's server and
display its web pages, a user must have a web browser installed.

Web browsers are used on a range of devices, including desktops, laptops, tablets, and smartphones. In


2020, an estimated 4.9 billion people used a browser. The most used browser is Google Chrome, with a
63% global market share on all devices, followed by Safari with 20%.

The purpose of a web browser is to fetch content from the Web or from a local storage device and display
it on a user's device.

This process begins when the user inputs a Uniform Resource Locator (URL), such as
https://en.wikipedia.org/, into the browser. Virtually all URLs on the Web start with either http: or https:
which means the browser will retrieve them with the Hypertext Transfer Protocol (HTTP). In the case
of secure mode (HTTPS), the communication between the browser and the web server is encrypted for the
purposes of security and privacy.

Once a web page has been retrieved, the browser's rendering engine displays it on the user's device. This
includes image and video formats supported by the browser.

Web pages usually contain hyperlinks to other pages and resources. Each link contains a URL, and when it
is clicked or tapped, the browser navigates to the new resource. Thus the process of bringing content to the
user begins again.

Most browsers use an internal cache of web page resources to improve loading times for subsequent visits
to the same page. The cache can store many items, such as large images, so they do not need to be
downloaded from the server again. Cached items are usually only stored for as long as the web server
stipulates in its HTTP response messages.
17
2.1.7.1 TYPES OF BROWSER

1. Internet Explorer
2. Google Chrome
3. Mozilla Firefox
4. Safari
5. Opera

2.1.8 NETWORKING
Networking is the exchange of information and ideas among people with a common profession or special
interest, usually in an informal social setting. Networking often begins with a single point of common
ground. Professionals use networking to expand their circles of acquaintances, find out about job
opportunities in their fields, and increase their awareness of news and trends in their fields or the greater
world.

2.1.8.1 TYPES OF NETWORKING


The types of networking are listed below;
1. Personal Area Network: A personal area network, or PAN, is a computer network organized
around an individual person within a single building. This could be inside a small office or
residence. A typical PAN would include one or more computers, telephones, peripheral devices,
video game consoles and other personal entertainment devices.

If multiple individuals use the same network within a residence, the network is sometimes referred
to as a home area network, or HAN. In a very typical setup, a residence will have a single wired
Internet connection connected to a modem. This modem then provides both wired and wireless
connections for multiple devices. The network is typically managed from a single computer but can
be accessed from any device. This type of network provides great flexibility. For example, it allows
you to:

 Send a document to the printer in the office upstairs while you are sitting on the couch with your
laptop.
 Upload a photo from your cell phone to your desktop computer.
 Watch movies from an online streaming service to your TV.
 If this sounds familiar to you, you likely have a PAN in your house without having called it by its
name

18
2. Local Area Network: A local area network, or LAN, consists of a computer network at a single
site, typically an individual office building. A LAN is very useful for sharing resources, such as
data storage and printers. LANs can be built with relatively inexpensive hardware, such as hubs,
network adapters and Ethernet cables. The smallest LAN may only use two computers, while larger
LANs can accommodate thousands of computers. A LAN typically relies mostly on wired
connections for increased speed and security, but wireless connections can also be part of a LAN.
High speed and relatively low cost are the defining characteristics of LANs.

LANs are typically used for single sites where people need to share resources among themselves
but not with the rest of the outside world. Think of an office building where everybody should be
able to access files on a central server or be able to print a document to one or more central
printers. Those tasks should be easy for everybody working in the same office, but you would not
want somebody just walking outside to be able to send a document to the printer from their cell
phone! If a local area network, or LAN, is entirely wireless, it is referred to as a wireless local area
network, or WLAN

3. Wide Area Network: A wide area network, or WAN, occupies a very large area, such as an entire
country or the entire world. A WAN can contain multiple smaller networks, such as LANs or
MANs. The Internet is the best-known example of a public WAN. A WAN can be setup both
physically and virtually. A WAN can connect multiple other LANs virtually, creating what is
called a VLAN. In this sense it is like a LAN of LANs!

When it comes to today's increased use of remote work connections, the WAN is a powerful tool
that provides interfaces to the Internet as well as giving access to systems that may be spread
throughout the world. One means of connecting to a WAN is through a VPN or virtual private
network. This allows a secure connection to the WAN, thus protecting your data and device from
attack. In addition to virtual connections, fiber optic provides a backbone to many WAN setups.

4. Metropolitan Area Network: A Metropolitan Area Network, or MAN, consists of a computer


network across an entire city, college campus or small region. A MAN is larger than a LAN, which
is typically limited to a single building or site. Depending on the configuration, this type of
network can cover an area from several miles to tens of miles. A MAN is often used to connect
several LANs together to form a bigger network. When this type of network is specifically
designed for a college campus, it is sometimes referred to as a campus area network, or CAN.

19
2.1.9 ONLINE VOTING SYSTEM
Online voting (also known as e-voting) is voting that uses electronic means to either aid or take care of
casting and counting ballots.

Depending on the particular implementation, e-voting may use standalone electronic voting machines (also
called EVM) or computers connected to the Internet. It may encompass a range of Internet services, from
basic transmission of tabulated results to full-function online voting through common connectable
household devices. The degree of automation may be limited to marking a paper ballot, or may be a
comprehensive system of vote input, vote recording, data encryption and transmission to servers, and
consolidation and tabulation of election results.

A worthy e-voting system must perform most of these tasks while complying with a set of standards
established by regulatory bodies, and must also be capable to deal successfully with strong requirements
associated with security, accuracy, integrity, swiftness, privacy, auditability, accessibility, cost-
effectiveness, scalability and ecological sustainability.

Electronic voting technology can include punched cards, optical scan voting systems and specialized
voting kiosks (including self-contained direct-recording electronic voting systems, or DRE). It can also
involve transmission of ballots and votes via telephones, private computer networks, or the Internet. In
general, two main types of e-voting can be identified:

 E-voting which is physically supervised by representatives of governmental or independent electoral


authorities (e.g. electronic voting machines located at polling stations);
 Remote e-voting via the Internet (also called i-voting) where the voter submits his or her vote
electronically to the election authorities, from any location.

2.1.9.1 TYPES OF ONLINE VOTING SYSTEM

1. Paper Based Electronic Voting System: Paper-based voting systems originated as a system


where votes are cast and counted by hand, using paper ballots. With the advent of electronic
tabulation came systems where paper cards or sheets could be marked by hand, but counted
electronically. These systems included punched card voting, mark sense and later digital pen voting
systems.

These systems can include a ballot marking device or electronic ballot marker that allows voters to
make their selections using an electronic input device, usually a touch screen system similar to a
DRE. Systems including a ballot marking device can incorporate different forms of assistive
technology. In 2004, Open Voting Consortium demonstrated the 'Dechert Design', a General Public
License open source paper ballot printing system with open source bar codes on each ballot.
20
2. Direct Recording Electronic Voting System: A direct-recording electronic (DRE) voting
machine records votes by means of a ballot display provided with mechanical or electro-optical
components that can be activated by the voter (typically buttons or a touchscreen); that processes
data with computer software; and that records voting data and ballot images in memory
components. After the election it produces a tabulation of the voting data stored in a removable
memory component and as a printed copy. The system may also provide a means for transmitting
individual ballots or vote totals to a central location for consolidating and reporting results from
precincts at the central location. These systems use a precinct count method that tabulates ballots at
the polling place. They typically tabulate ballots as they are cast and print the results after the close
of polling.

2.1.10 POLLING

Polling place online voting and remote i-voting (Internet voting) systems of election have been used in
different democratic societies. The United States, Australia, Estonia, Japan, Brazil and India are at
various stages of online voting adoption. In Africa, Namibia was the first country to transit to online
voting in its 2014 general elections. In SUG, Kaduna State is the first state to adopt an online voting
system.
The advantage of online voting over the conventional voting system is obvious. Convenience is an
attribute of online voting that enhances participation and remedies apathy associated with traditional
voting methods. Online voting makes it easier for people to make their views known and cast their
votes, an important requisite for a constructive democratic process. Furthermore, poorly designed paper
ballots, which might have been filled in or counted incorrectly becomes a thing of the past if e-elections
are adopted.

21
2.2 REVIEW OF RELATED WORK

(Gaurav Kumar, Smriti Gupta, Divya Agarwal, Astha Tiwari, 2021) Worked on the virtual
voting system. The researchers said that India's voting system plays an important role in Indian
Democracy. The existing system is offline and has certain weaknesses. In recent years, the spread
of covid19, inefficient rural voters, people far from their place of birth, paper waste affecting
nature, budgets that should be used for development, invisible fraud, waste of human labor, have
been recorded and can be avoided by the virtual voting system. The research aims to supply an
easy and secure electoral system in India. The method used descriptive qualitative. The results
indicate that a virtual voting system is environmentally friendly and is considered a resource-
saving way for the election. It is because minimizes errors and increases voter participation
through convenient virtual voting. In conclusion, a virtual voting system can develop an Aadhar
based advanced Electronic Voting Machine (EVM), which helps in a free and fair way of
conducting elections.

(Taban Habibu, Konde Sharif, Sebwato Nicholas, 2017) Worked on the Public opinion and
democratic in polytechnic setting are the most important determinant to establish a good
administration. Voting is the process through which individuals convey their opinion and has the
freedom to elect a leader of the choice to signify and address the student’s issues. In today’s
technological and knowledge age, computerized related matters become widespread. E-voting is
one of these substances and it is capable to deliver appropriate, less costly, fast and secure
services. The aim of this paper is to present an electronic voting system (E-Voting) to be applied
to Muni University student’s electoral body. Several security measures were integrated into the
E-Voting system in order to achieve an enhanced, speedy and accurate performance. A computer
software application was developed using PHP (Hypertext processor) programming language and
MYSQL (My Structural Query Language), a relational database management system in
designing the database; tested and found to have produced the expected results. It is about time
that traditional voting in Muni University gives way to E-Voting and hence simplifies the task for
Electoral commission and his/her Officials.

22
(M.A Hosany, N. Chedembrun, 2017) Worked on the Voting systems have been present for long time
but, with the emergence of new web technologies, the conventional electoral process, be it is for
general election or for electing candidates for student council in a university, should be
modernized. Electronic voting is one of the most troublesome overhauls faced to obtain a perfect
outcome hence, this innovation touches the heart of the whole electoral process that is voting and
tallying of the votes. Online voting significantly decreases direct human control which is viewed as
a positive point but at the same time it presents an entire scope of new concerns. This paper
provides the specification and requirements to meet „University of Mauritius (UoM) Student
Online Voting System which is an android based application to be used by the students of
University of Mauritius during the Student Union Election. It covers the entire system development
life cycle from the identification of a solid problem to background research about the topic on to
analysis, design and implementation of an android based application. The concluding sections
cover the application testing and evaluation as well as possible enhancements to the application.

(Lauretha Rura, Biju Issac and Manas Kumar Haldar, 2020) Worked on the way online voting systems
are made available, we propose a new and secure steganography based E2E (end-to-end) verifiable
online voting system, to tackle the problems in voting process. This research implements a novel
approach to online voting by combining visual cryptography with image steganography to enhance
system security without degrading system usability and performance. The voting system will also
include password hashed-based scheme and threshold decryption scheme. The software is
developed on web-based Java EE with the integration of MySQL database server and Glassfish as
its application server. We assume that the election server used and the election authorities are
trustworthy. A questionnaire survey of 30 representative participants was done to collect data to
measure the user acceptance of the software developed through usability testing and user
acceptance testing.

23
(Okpeki U. K. and Oyubu A. O., 2021) Worked on the amount of money spent on the production of
ballot papers and other electoral materials has increased exponentially over the years. Large
democracies such as Nigeria’s require more balloting materials running into billions of dollars for a
national election. These materials which are neither transferable nor reusable are valid for just a
session of election; thus, whatever is left after an election cannot be re-used. This means that after
every election, a similar or higher budget than the preceding one is required for the next election.
This results in a colossal waste of revenue. An electronic voting system eliminates the use of ballot
papers and other electoral materials, gives an accurate result, and generally eliminates electoral
fraud which has characterized elections in most Sub-Sahara African countries over the years. The
system is re-useable as it can also be reset to conduct the fresh election as the needs arise. This
paper, the design and construction of an electronic voting system, presents a simple electronic
voting system. It is made up of both hardware, and software sections. While the hardware section
consists of a microcontroller.

2.2.1 TIMELINE FOR THE PROJECT

The completion period for the project is done by using Gantt chart. A Gantt chart is a horizontal
bar chart which consists of Task, Start Time, Duration and End Time.

FIG 2.1 Gantt chart

24
CHAPTER THREE
SYSTEM ANALYSIS AND DESIGN

3.1 INTRODUCTION
This chapter discussed how the current voting system works. It also discussed the gaps researchers
found with existing system. This chapter also presented the proposed system, its requirements and also
advantages the proposed system over the current system.

3.2 ANALYSIS OF THE EXISTING SYSTEM


The current voting system is paper based. With this system the voters register are collected from the
individual Departments, at the time of the election which is conducted by the election board chosen
by the current holders of the guild office, the voters are then to vote per department where each
student will have to present any identification eg id card, docket showing whether he/she is a
bonafide voters, he/she is then given two ballot papers both for department member of parliament
and presidential candidate. After the end of voting exercise which usually runs from as early as
seven in the morning till six in the evening, the votes are then counted per department then the total
for presidency from each department is summed together and the results announced by the head of
the election board.

3.3 WEAKNESS OF THE EXISTING SYSTEM


The Weakness of the existing system are as follows;
1. Easy Manipulation of the Election Board: The election board with current voting system is
selected by the current guild official, this can be a loop hole in the voting in that current guild
officials with vested interest can manipulate the whole exercise of choosing the election board
putting those who can serve their purpose probably of rigging the election.
2. Manual Counting of Votes: With the current voting system the votes are counted manually; this
process is tedious, time consuming and prone to errors.
3. Delay of Announcement of Result: Manual counting of votes take time in that, with votes of
more than sixty percent of the polytechnic; counting all this votes is a process which takes time,
and with the voting ending at six in the evening the votes counts take more than six hours to tally
all the votes, this thereby takes the whole exercise till late at night hence its subject to
manipulation.

25
3.4 DATA COLLECTION TECHNIQUES
The data collection technique used in the SUG election is a Primary Method of data collection where
data are been collected from students who are willing to vote during the SUG election. And we are
making use of existing data already collected by previous literature on SUG’s elections to analyze the
election process and derive a conclusion on how to eliminate the issues.

3.5 ANALYSIS OF THE PROPOSED SYSTEM

Online voting system serves to provide a remedy for the inaccessible registration and voting venue as
eligible candidates can be registered and vote at their place of residence for their votes to count for their
particular place of origin. It also provides a means to eliminate ballot box snatching as votes are
counted as they are cast. There is also less room for result manipulation because the result get updated
and displayed to all as votes are being counted.

3.6 SYSTEM FLOWCHART


The System flowchart show the directory of flows on how the system/software could be used.
These are under listed below;

3.6.1 ADMINISTRATIVE LOGIN PAGE


The administrative login page show and authenticate how you could access the administrative dashboard
where the election processes are been managed. The flowchart for the admin login page operation is
shown below.

26
Figure 3.1: Flowchart of Administrator Login

3.6.2 ADMINISTRATIVE DASHBOARD

The administrator dashboard is a desktop software application managing the elections. It incorporates
the basic CRUD (Create, Read, Update and Delete) features for monitoring and managing voters,
administrators, elections and the voting devices. It accesses the server which for its data that are
contained in the database. The administrator dashboard has a login page as shown below to restrict
unauthorized access to the dashboard. The login will require administrator email and password for
authentication and validates it against the values in the database. If validation succeeds, access to the
dashboard is granted, else he/she is restricted. The flowchart for the admin dashboard operation is
shown below.

27
Figure 3.2: Flowchart for Administrators Dashboard

28
3.6.3 REGISTRATION PLATFORM

This is where the voters are registered prior to an election. The setup of the registration platform
consists of the students Matriculation number.

The registration software application has features the enables voter’s registration, which involves
collecting voters data and storing the data in the database through the server. It interfaces with other
built-in programs to be able to interact with the fingerprint scanner, card reader and camera hardware
used for capturing different user data. The program flowchart is shown below.

Figure 3.3: Flowchart for Voter Registration

29
3.6.4 VOTING INTERFACE
The voting interface is the software that will run on the electronic device. It works with other programs
to interact with the fingerprint scanner and the smart card reader. The flowchart for the voting interface
is shown below.

Figure 3.5: Flowchart of Voting Interface

3.6.5 RESULT INTERFACE

The result interface design is such that anyone can have access to election results, hence no
authentication is required to access this service. Nevertheless, data is transmitted over secure protocols
to insure integrity of the results being shown. The interface makes use of bar graphs and chats to show
live election results. The result interface program flowchart is shown below.

30
Figure 3.6: The Result Interface Flowchart

A use case diagram is used to capture the online voting system requirements as shown in figure 3.7
below.

Figure 3.7: Use case Diagram used to capture the Online voting System requirements

31
3.7 ENTITY AND RELATIONAL DIAGRAM

The design of the system to meet the requirements above is depicted in the system block diagram as
shown in figure 3.8 below

Figure 3.8: Entity and Relational Diagram

3.7.1 SOFTWARE DESIGN

The software design consists of all the software platforms needed for the system functioning and their
interactions. The figure 3.9 below shows a block diagram of the software part of the system.

32
Figure 3.9: Software Design Block Diagram
3.7.2 DATA DICTIONARY
3.7.3 DATABASE

A NoSql database which is an object-relational database is designed. This approach is used as election
data is better represented as objects and it still maintains the advantage relational mapping of data
brings. The Entity relationship diagram (ERD) shown below in figure 3.10 presents a schematic view
of the online voting database.

SERVER

The server is designed with a REST API architecture. REST in the sense that the server is stateless as it
does not store data, it only defines certain protocols for which data in the database can be stored,
accessed, modified or removed. The server will use access tokens for security while sensitive user data
like passwords will be hashed before being stored in the database. A flow block diagram of the server
is shown below in figure 3.10.

Figure 3.10: The Server

33
CHAPTER FOUR

SYSTEM IMPLEMENTATION AND EVALUATION

4.1 PROGRAM DEVELOPMENT

The program development gives the detailed explanation on how the program is been developed, how it
been run and the interface involved in the program.

4.2 SYSTEM REQUIREMENTS


This chapter explains the implementation of the online voting system to with respect to the system
requirement specification (SRS) document. The system requirement is sub divided into:
1. System software requirement

2. System hardware requirement

4.2.1 SOFTWARE IMPLEMENTATION AND UNIT TESTING

The software section was implemented based on the design given in chapter three, figure 3.9

4.2.1.1 ADMINISTRATOR DASHBOARD

The admin dashboard was implemented with Electronics, a framework for building cross platform
desktop application with PHP, CSS and JavaScript. The software was built and packaged for windows
operating system. Its login page for restricted access is shown below in figure 4.1, while the main
admin dashboard is shown in figure 4.2 below.

TABLE 4.1: UNIT TEST FOR ADMINISTRATOR DASHBOARD

Test Steps Expected Result Test result


Install double click the Software correctly installed Software
software installer, installed
follow the installation successfully
prompt
Login pass input admin email Show admin dashboard with Admin
input admin password welcome message with admin dashboard
click the login button name shown
Login failed input admin email Display email or password invalid Display email or
input admin password password invalid
click the login button
Display data Automatically query Show data on the dashboard Data shown on the
the data from the dashboard
server
Log out Click log out button Send admin to log in screen Admin sent to
login screen

34
Figure 4.1: Administrator Login Screen

Figure 4.2: Administrator Dashboard View

35
4.2.1.2 VOTING INTERFACE

The voting interface is written in PHP which makes use of C++ and CSS libraries to interface with the
peripherals. Voting data is first encrypted before it is then transmitted over HTTPS to ensure security.
The software code is contained in appendix A. The voting software implementation is shown below in
figure 4.3.

Figure 4.3: Voting Interfaces Implementation

36
TABLE 4.2: UNIT TEST FOR VOTING INTERFACE

Test Steps Expected Result Test result


Get voter Get card ID from card Show voter detail Voters’ detail
Detail Voter detail from server Shown
Get voter Send request to the server Show voter elections Voter elections
election Get voter election from shown
Server
Cast vote Click the selected party Show Voted Voted shown
Click next button
Send votes to Get votes Votes sent Votes sent
server Encrypt votes
Send encrypted votes to
server

4.2.1.3 RESULT INTERFACE

The result has two implementations: A desktop app built with Electronics and a web portal built with
HTML, CSS and JavaScript and hosted with Github Pages at (Error! Hyperlink reference not valid.
result/index.html). The desktop app is built and packaged for windows operating system. These
interfaces receive result data over through HTTPS from the server this is to ensure security.

TABLE 4.3: UNIT TEST FOR RESULT INTERFACE

Test Steps Expected Result Test result


Load result Type url in Show result interface Result interface
page browser click enter shown
Page speed Open network tab Load time less than or equal Load time 1.65s
to 1.7s

The result interface is shown below.

37
Figure 4.4: The Result Interface Implementation

38
4.2.1.4 REGISTRATION INTERFACE

The registration software is implemented in Java and makes use of C++ and Python libraries to
interface the system peripherals. All data is encrypted and transmitted over HTTPS to the server.
It begins with a login page to authentic the registrar.

TABLE 4.4: UNIT TEST FOR REGISTRATION INTERFACE

Test Steps Expected Result Test result


Register voter Get all voter details Display voter registered Voter Registered
Check for input validity Displayed
Capture passport image

Slot in a card
Click register
Send details to server
Write detail to card
Install Double click on installer Software installed correctly Software was
registration Follow installation prompt installed
Software correctly

Login registrar Input registrar email Display Registration Registration


Input registrar password Interface screen shown
click login

39
The registration interface is shown below in figure 4.5.

Figure 4.5: Registration Interface Screen

4.2.1.5 SERVER

The server API is built with Nodejs, a JavaScript run-time outside the browser. The API routes are
protected and can only be accessed via an authentication token. All sensitive data like passwords are

hashed before they are sent to the database for storage. The server is hosted on Heroku, a cloud based
hosting service. The server was tested with Postman software application and the routes were
documented using Postman docs.

40
TABLE 4.5: UNIT TEST FOR SERVER

Test Steps Expected Result Test result


Security Make a request using Display unverified token Displayed
Postman. unverified token
Leave authentication token
empty
Test for route Make a request to a route Response to a request from Same response no
consistency using Postman particular route is same for matter the number
On received response all request made of times request
Make another request to the was made
same route
Latency test Make a request using Latency should be less than Latency was 43
Postman 48 for a good server
Record response time and
data size of data sent for
each request made
Scalability Add new routes All routes both the new and All routes still
Check if the former routes old ones behave well. functional
have issues
Deploy server Open the terminal Display Displayed
online type git push heroku master Build successful Build successful
press enter Deployed successful Deployed
successful

41
4.2.1.6 DATABASE

A NoSql Object-Relational database was implemented using MongoDb and saved on Heroku server
using mLab a MongoDB hosting service. Only the API has direct access to the database which it
accessed with a database key on a secure production environment variable file hosted on Heroku.

Table 4.6: Unit test for the Database

Test Steps Expected Result Test result


Security Try to access the Access denial Was denied
database without going access
through the server to
verify
Data integrity Save data through the server The data is same as the one Received same
Request for that data saved data, data was
not damaged
Scalability Increase the capacity of the The new tables were added New tables
database to accommodate and the old one wouldn’t added and other
more tables Break tables still intact
Latency Fetch data from the database
through the server, monitor
the database response time

42
4.2.2 HARDWARE REQUIREMENT AND UNIT TESTING

4.2.2.1 POWER UNIT

This generates the power required for the devices to operate in a good working condition. It also
powers some LEDs for indication purposes. It contains a 12V battery to supply power to the devices in
the absence of external power. The input to the power unit is a 220V AC which is stepped down and
converted to DC. This output is used to power the touch screen module and the raspberry pi.

4.2.2.2 CONTROL UNIT

The control unit is the heart of the system. It is a raspberry pi model 3b running raspbian OS
(linux). The operating system provides the resources necessary to generate a graphical user interface
for the application. It also provides low level libraries to enable easy integration with other peripheral
(hardware) devices. It communicates with the card reader, the fingerprint sensor and the touch screen
via its USB ports which serves as a source of power to some of the peripherals like the fingerprint and
the card reader.
The voting application or software written in java and python, runs on this operating system and
communicates with the peripheral devices by using the low level libraries provided by the operation
system.

TABLE 4.7: UNIT TEST FOR CONTROL UNIT

Test Steps Expected Result Test Result


Raspberry pi power Plug the raspberry pi The red LED on The red LED came
power cord to a power the raspberry pi on
Source should come on
Raspberry pi OS boot Put the SD card in the The green LED on The green LED
raspberry pi and power the raspberry pi came on
on the raspberry pi should come on

Start Application Attempt to run the vote The application The application ran
application should run without without errors
errors

43
4.2 SYSTEM INTEGRATION AND TESTING

All the different units explained above where put together such that the fingerprint scanner, camera and
smart card reader writer for the registration was added to the registration platform running on
a Windows system. The registration platform was also connected to the online Server. The result
website was hosted online at Online voting Result (https://bit.ly/32Y5z6q) and linked to the online
Server. The administrator dashboard was installed on a Windows system and linked to the online
Server as well. At the voting device end, the fingerprint module is coupled to the Raspberry pi, also the
smart card reader and LCD touch screen is connected to the Raspberry pi and coupled into the voting
system. The battery unit is added to the voting device too and the voting software is burnt to a memory
card and inserted into the Raspberry pi memory card slot. The system is started up and the voting
device is working.

44
TABLE 4.8: OVERALL SYSTEM TESTING

Test Steps Expected Result Test Result


Register a voter Double click the Display Registration Registration
registration software Successful Successful displayed
Login as a Registrar
Fill all input fields
Capture passport
image and
fingerprints
Write details to card
Cast vote Authenticate as PO Screen should display
slot in card “Voted ”
“Voted ”
choose parties
Displayed
confirm votes with
fingerprint
View election result Visit Result interface Result interface
https://bit.ly/32Y5z6q should show shown
on the browser
window.
Monitor changes on Double click Administrator Administrator
administrator administrator Dashboard should dashboard shown
dashboard software icon show with a welcome with “Welcome
Input admin email message for the admin MaryBlessing”
and password to login

Click login

4.3 SYSTEM INTERFACE


The system interface are as follows;
1. Administrators Login Interface
2. Administrators Dashboard Interface
3. Voters Registration Interface

45
4. Voting Interface
4.4 SYSTEM PERFORMANCE
The system is designed to perform the following;
 Voters Registration
 Voting Interface
 Result Interface

4.5 SYSTEM TRAINING


The Electoral board is been trained on how the system is been used, the registration processes to
undergo, how the Administrator can login and access their dashboard. They also enlighten the oters on
how they could be able to cast their votes online.

46
CHAPTER FIVE
CONCLUSION AND RECOMMENDATION

5.1 SUMMARY

The manual system of voting in SUG has failed to tackle the basic issues necessary for a clean and trusted
voting environment which has evidently driven some of its citizens to apathy.
The Online voting system was implemented to solve the proximity bottlenecks, unnecessary time delays,
with very secure and accurate recording of votes. The system has been thoroughly tested in voting
accuracy, ruggedness, responsiveness, and security by means of simulation and mini voting sessions to be
a successful one. It is seen that the system is fault tolerant at all end points (registration, voting platform
and the server).
This system will provide boundless voter participation in remote areas with very little or no cost on the
voter greatly reducing apathy. Further improvements can be done on the system to increase the credibility
of the votes and further reduce proximity issues.

5.2 RECOMMENDATION(S)

The following recommendations are made for optimal performance of the system:

1. Online Voting (E-voting): the use of smart phones or any internet connected device to cast
votes from any location.

2. The e-voting system and equipment should be tested by an independent body which
performs tests based on publicly available technical standards and specifications. Any
modifications of e-voting system components, in either hardware or software, should be
documented, and separately and integrally tested and certified based on publicly
available technical standards and specifications.

3. The voter interface should be modified in such a way that abstention is subject to the same
voter-verification options as selection of candidate i.e, a confirmation function should be
added.

5.3 CONCLUSION
The Online voting interface was programmed in such a way that it has a registration interface, and
the voting interface, of which it is programmed that if a voter has voted, there will be no other

47
room to revote anymore. More also, objectives were achieved by using HTML, CSS, and
JavaScript to develop the web page and MySQL to create the database.

48
REFERENCES
[1].
Gaurav Kumar, Smriti Gupta, Divya Agarwal, Astha Tiwari. (2021). VIRTUAL VOTING SYSTEM. International
Journal of Informatics,Information System and Computer Engineering, 1-32.

[2]. Lauretha Rura, Biju Issac and Manas Kumar Haldar. (2020). Implementation and Evaluation of
Steganography based Online Voting System. International Journal of Information, Information System, and
Computer Engineering, 1-23.

[3]. M.A Hosany, N. Chedembrun. (2017). Design and implementation of an online voting for the election of
students of the University of Maurituis. International Journal of Advanced Research in Science,
Engineering and Technology, 1-14.

[4]. Okpeki U. K. and Oyubu A. O. (2021). Design and Construction of an Electronic Voting System.
JOURNAL OF SCIECNCE TECHNOLOGY AND EDUCATION , 1-6.

[5]. Taban Habibu, Konde Sharif, Sebwato Nicholas. (2017). Design and Implementation of Electronic Voting
System. International Journal of Computer & Organization Trends (IJCOT), 1-23.

[6] Paul David Webb, Roger Gibbins, Heinz Eulau, “Election”, Encyclopaedia Britannica. [Online].
Available: https://www.britannica.com/topic/election-political-science. [Accessed: Aug. 05, 2019].

[7] Toba Paul Ayeni, Adebimpe Omolayo Esan, “The Impact of ICT in the Conduct of Elections in
SUG”, American Journal of Computer Science and Information Technology, February 09, 2018 .
[Online]. Available: http://www.imedpub.com/articles/the-impact-of-ict-in-the-conduct-of-
elections-in- SUG.php?aid=22211. [Accessed: Aug. 05, 2019].

[8] ACE, Online voting, The Electoral Knowledge Network, n.d., [Online]. Available:
http://aceproject.org/ace-en/focus/online voting/default. [Accessed: Aug. 07, 2019].

[9] Victor Ekwealor, Inside SUG’s first ever electronic voting exercise in Kaduna State, Techpoint
Africa, May 14, 2018, [Online]. Available: https://techpoint.africa/2018/05/14/kaduna-electronic-
voting/. [Access: Aug. 10, 2019].

49
[10] Alexandra Petruș,Whatiswo-fcr autheni (2FA)?,PhoneBackupExtr, O. 08 ,, What is two-factor authentication (2FA)?, iPhone Backup Extractor, Oct.
08, 2017, [Online]. Available: http://www.iphonebackupextractor.com/blog/2016/jun/3/extract-data-
two- factor-authentication/. [Accessed: Aug. 11, 2019].

[11] van Tilborg, Henk C.A.; Jajodia, Sushil, eds. (2011). Encyclopedia of Cryptography and
Security, Volume 1. Springer Science & Business Media. p.1305.

[12] Jason Cipriani, Seth Rosenblatt, Two-factor verification: What you need to know (FAQ), CNET,
June 15, 2015, [Online]. Available: https://www.cnet.com/news/two-factor-authentication-what-
you- need-to-know-faq. [Accessed: Aug. 10, 2019].

[13] Alexandra Dmitrienko, Christopher Liebchen, Christian Rossow, and Ahmad-Reza Sadeghi “On
the (In) Security of Mobile Two-Factor Authentication” Lecture Notes in Computer Science,
pp. 365-383, Nov 2014.

[14] Alireza Pirayesh Sabzevar, Angelos Stavrou “Universal Multi-Factor Authentication


Using Graphical Passwords”, Proceedings of the 2008 IEEE International Conference on Signal
Image Technology and Internet Based Systems. pp. 625-632, 2008.

[15] Olufemi Sunday Adeoye “Evaluating the Performance of two-factor authentication solution in the
Banking Sector” IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 2,
July 21.

[16] Rahul Kale, Neha Gore, Kavita, Nilesh Jadhav, Swapnil Shinde “ Review Paper on Two Factor
Authentication Using Mobile Phone” International Journal of Innovative research and Studies,
Vol. 2, Issue 5, pp. 164 - 170, May 2013.

[17] Van Tilborg, Henk C.A.; Jajodia, Sushil, eds. (2011). Encyclopedia of Cryptography and
Security, Volume 1. Springer Science & Business Media. p.1305.
[18] CardLogix Corporation, Smart Card Basics, CardLogix Corporation, 2010. [Online] Available
from: http://www.smartcardbasics.com [Accessed 1/05/19].

50
[19] MichaL Bairanzade, Smart card integration and specifications, ASPENCORE, 2002. [Online]
Available from: https://www.eetimes.com/document.asp? doc_id=1200923 [Accessed 1/05/19].

[20] Wikipedia, Smart card, Wikipedia, Wikipedia, n.d. [Online] Available from:
https://en.wikipedia.org/wiki/Smart_card [Accessed 29/04/19].

[21] S.L.Nita, M.I.Mihailiscu, V.C. Pau,” Security and CryptographicChallenges for Authentication
Based on Biometrics Data”, www.mdpi.com/journal/cryptography, pp.1-22, 2018,

[22] K. Nallaperumall, A. L. Fred and S. Padmapriya, “A Novel for Fingerprint Feature Extraction
Using Fixed Size Templates”, IEEE 2005 Conference, pp. 371-374, 2005.

[23] M. Egele, D. Brumley, Y. Fratantonio, and C. Kruegel, “An empirical study of cryptographic
misuse in Android applications,” in Proceedings of the ACM SIGSAC Conference on Computer
& Communications Security (CCS 2013), pp. 73–83, ACM, Berlin, Germany, November 2013.

[24] Kumar,R. Chandra,P. Hanmandlu, M.,”Local directional pattern (LDP) based fingerprint
matching using SLFNN”, IEEE Second International Conference on Image Information
Processing (ICIIP), Pages: 493 - 498, DOI: 10.1109/ICIIP.2013.6707640, 2013.

[25] N. Vurukonda and B.T. Rao, “A Study on Data Storage Security Issuesin Cloud,” Computing.
Procedia Computer Science, 92, pp. 128-135, 2016.

[26]Ruxandra Burtica, Eleonora Maria Mocanu, Mugurel Ionuţ Andreica, Nicolae Ţăpuş,
“Practical application and evaluation of no-SQL databases in Cloud Computing”, IEEE 2012

[27] Hoxmeier, J. A., &DiCesare, C. (2000). System response time and user satisfaction: An
experimental study of browser-based applications. AMCIS 2000 Proceedings, 347.

[28] Agrawal, S., Chaudhuri, S., Kollar, L., Marathe, A., Narasayya, V., &Syamala, M. (2005,
June). Database tuning advisor for microsoft SQL server 2005: demo. In Proceedings of the 2005
ACM SIGMOD international conference on Management of data (pp. 930-932). ACM.

51
[29] R.Jeberson Retna Raj, T.Sasipraba,(2014) “Privacy Preserving of Sensitive Data in Cloud based
on Fully Homomorphic Encryption (FHE) Technique”, Global Journal of Pure and Applied
Mathematics. ISSN 0973-1768 Volume 10, Number 3 (2014), pp. 431-441.

[30] Sarah P. Everett, Kristen K. Greene, Michael D. Byrne, Dan S. Wallach, Kyle Derr, Daniel
Sandler and Ted Torous, “Electronic Voting Machines versus Traditional Methods: Improved
Preference, Similar Performance”, in the Proceedings of Measuring, Business, and Voting,
Florence, Italy, April 5-10, 2008.

[31] T. Kohno, A. Stubblefield, A. D. Rubin and D. S. Wallach, “Analysis of an Electronic Voting


System”, IEEE Symposium on Security and Privacy 2004. IEEE Computer Society.
[32] Olivier Baudron, Pierre-Alain Fouque, David Pointcheval, Jacques Stern, and Guillaume
Poupard. Practical multi-candidate election system. In PODC, pages 274–283, 2001.

[33] Thomos M.Buchsbaum, “Online voting: International developments and lesson learnt”,
Technical Report by Australian Federal Ministry for Foreign Affairs, 2004.

[31] “Electronic Voting - Evaluating the Threat,” Michael Ian Shamos, CFP '93. [Online]
Available: http://www.cpsr.org/conferences/cfp93/shamos.html\. [Accessed: Sept]

[32] N. Munassar and A. Govardhan, “A Comparison Between Five Models Of Software


Engineering”, IJCSI International Journal of Computer Science Issues, vol. 7, no. 5, 2010

52
Appendix A
Java code for Voting Interface
//////////////////////////java////////////////////////
package com.prime.ev;

import java.io.*;
import java.lang.reflect.Array;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.*;

import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.ScrollPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

import javax.imageio.ImageIO;

/**
* Created by Prime on 8/4/2019.
* DisplayManager is responsible for handling graphical interfaces,
* and update the interface on request.
*/
public class DisplayManager {
private Stage primaryStage;
private static ArrayList<Scene> sceneList;
private final String SCENE_NAME_FORMAT = "scene/scene";

final int DELAY_MILLIS = 2000;


private final SceneFunction sceneFunction;
public static int addedScenes = -1;

boolean inFinalScenes = false;

private Map<String, String> currentElectionCodeMap;

DisplayManager(Stage primaryStage) {
this.primaryStage = primaryStage;
sceneList = new ArrayList<>();
currentElectionCodeMap = new HashMap<>();
sceneFunction = new SceneFunction();

53
new Thread(this::initializeAndStartFirstScenes, "Initialize First Scenes").start();
}

private void initializeAndStartFirstScenes() {


setSceneFromIndex(1, DisplayAccessor.NEW_VOTER_SCENE);
setScene(sceneList.get(0)); //start first scene
}

private void setSceneFromIndex(int fromIndex, int toIndex){


for(int i=fromIndex; i<=toIndex; i++){
try {
URL fxml_url = getClass().getResource(SCENE_NAME_FORMAT + i + ".fxml");
if (fxml_url == null) break;
Scene scene = new Scene(FXMLLoader.load(fxml_url));
scene.getStylesheets().add(getClass().getResource("scene/scene_style.css").toExternalForm());
sceneList.add(scene);
}catch(IOException e){e.printStackTrace();}
}
}

protected Map<String, String> getCurrentElectionCodeMap(){


return currentElectionCodeMap;
}

private int initializeVoterScenes(ArrayList<ElectionData> electionBundle, Map<String, String> userDetails) throws


IOException{
if (electionBundle==null) throw new NullPointerException("electionBundle is null");

URL fxml_url = getClass().getResource("scene/scene5.fxml");


int numberOfVoterScenes = 0;

//backup and restore true scene3 as first scene either as sceneIndex 3(before final scenes)
// or sceneIndex 1 after final scenes
if(inFinalScenes){
Scene scene3 = getScene(DisplayAccessor.ANOTHER_NEW_VOTER_SCENE); //as sceneIndex 1
sceneList = new ArrayList<>();
sceneList.add(scene3);
} else{
Scene scene3 = getScene(DisplayAccessor.NEW_VOTER_SCENE); //as sceneIndex 3
sceneList = new ArrayList<>();
sceneList.add(scene3);
}

//set scene 4 user details


Parent parent4 = FXMLLoader.load(getClass().getResource("scene/scene4.fxml"));
Scene scene4 = new Scene(parent4, DisplayAccessor.SCREEN_WIDTH, DisplayAccessor.SCREEN_HEIGHT);
scene4.getStylesheets().add(getClass().getResource("scene/scene_style.css").toExternalForm());

userDetails.forEach((data, value)->{
try{
((Label) scene4.lookup("#"+data)).setText(": "+value);
}catch(NullPointerException npe){
System.out.println("no "+data+" field found on scene");
}
});
54
Image userImage;

{
UserData usd = sceneFunction.getUserData();
ArrayList<Byte> imageByteList = (ArrayList<Byte>) usd.image.get("data");
byte[] imageBytes = new byte[imageByteList.size()];
Object[] bytes = imageByteList.toArray();
for (int i = 0; i < imageByteList.size(); i++)
{
imageBytes[i] = (byte) (double) (Double) bytes[i];
}

InputStream i = new ByteArrayInputStream(imageBytes);

//compress
/*
* This should be done on the registration end instead
*/
try {
ImageCompressor.compress(ImageIO.read(i), new File("imtemp"), "jpg", 0.4f);
userImage = new Image(new FileInputStream("imtemp"));
//if successful, clear waste data for raspi
imageByteList = null;
imageBytes = null;
bytes = null;
} catch (IOException ioe) {
ioe.printStackTrace();
userImage = new Image(i);
}
}

ImageView imageView =

(ImageView)scene4.lookup("#userImage");

imageView.setFitWidth(512);
imageView.setFitHeight(512);
imageView.setPreserveRatio(false);
imageView.setClip(new Circle(imageView.getFitWidth()/2, imageView.getFitHeight()/2,imageView.getFitWidth()/2));
imageView.setImage(userImage);

sceneList.add(scene4);

//set the screened vote scenes for the voter


for(ElectionData electionData: electionBundle){
if(isVoterEligible(electionData, userDetails)) {
Parent parent =
FXMLLoader.load(fxml_url);
Scene scene = new Scene(parent, DisplayAccessor.SCREEN_WIDTH, DisplayAccessor.SCREEN_HEIGHT);
scene.getStylesheets().add(getClass().getResource("scene/scene_style.css").toExternalForm());
String lgaInfoFormat = " ("+userDetails.get("lga")+")";
String appendLga = "";
try{
55
appendLga = !electionData.getTitle().contains("President") ? lgaInfoFormat:"";
}catch(NullPointerException npe){npe.printStackTrace();}
((Label) scene.lookup("#electionTitle")).setText(electionData.getTitle()+
appendLga);

56
ListView listView = ((ListView) scene.lookup("#partyList"));
listView.setItems(FXCollections.observableArrayList(wrapInView(electionData.getPartyList())));

currentElectionCodeMap.put(electionData.getTitle(), electionData.getCode());
sceneList.add(scene);
++numberOfVoterScenes;
}
}

//set the final last 3 scenes


setSceneFromIndex(6, 8);

return numberOfVoterScenes;
}

private class isEligible{


private boolean value;
isEligible(boolean b){value = b;}
boolean getValue(){return value;}
void setValue(boolean b){value =
b;}
}

private boolean isVoterEligible(ElectionData electionData, Map<String, String> userDetails){


final isEligible eligible = new isEligible(true);
electionData.getCriteria().forEach((criteria, value)->{
if(criteria.equals("age")){
//do some calc in check
/*@debug*/System.out.println("checking age restriction");
}
else if(!userDetails.get(criteria).equalsIgnoreCase(value)) eligible.setValue(false);
});
return eligible.getValue();
}

private ArrayList<StackPane> wrapInView(ArrayList<String> partyNameList) throws IOException{


ArrayList<StackPane> sPanes = new ArrayList<>();
for(String partyName: partyNameList){
StackPane sPane = FXMLLoader.load(getClass().getResource("customfx/party_box.fxml"));
((Label) sPane.lookup("#party_name")).setText(partyName);

Image partyLogo;
try{ partyLogo = new Image(DisplayAccessor.RESOURCES+"/logo/"+partyName+".jpg"); }
catch(IllegalArgumentException i){
partyLogo = new Image(DisplayAccessor.RESOURCES+"/logo/default.jpg");
}
((ImageView) sPane.lookup("#party_logo")).setImage(partyLogo);
sPanes.add(sPane);
}
return sPanes;
}

/*
* Runs the inner scenes
* Note: i corresponds to scenex.i.fxml
*/
57
private void playScene(int scene_no) {

58
/*@debug*/System.out.println("\nplayScene invoked with scene number: "+scene_no);

if(inFinalScenes) return; ///for now

new Thread(()->{
try{
for(int i=1; ; i++){
Thread.sleep(DELAY_MILLIS);
URL fxml_url = getClass().getResource(SCENE_NAME_FORMAT+scene_no+"."+i+".fxml");
/*@debug*/System.out.println("searched resource: "+SCENE_NAME_FORMAT+scene_no+"."+i+".fxml");
if(fxml_url == null) {
/*@debug*/System.out.println("resource not found"); break;
}
/*@debug*/System.out.println("found "+fxml_url.toExternalForm());
setRoot(fxml_url, i);
}
} catch(Exception e){ e.printStackTrace(); }
}, "Play Scenes").start();
}

private void setScene(Scene scene) {


if(Thread.interrupted()) return;

Platform.runLater(()->{
primaryStage.setScene(scene);
try{
playScene(indexOfScene(getCurrentScene()));
invokeSceneFunction(indexOfScene(getCurrentScene()));
} // +1 to get actual file index
catch(Exception e){e.printStackTrace();}
});
}

void setScene(int sceneConstant){


switch (sceneConstant){
case DisplayAccessor.ANOTHER_NEW_VOTER_SCENE:
setScene(getScene(DisplayAccessor.ANOTHER_NEW_VOTER_SCENE)); break;
case DisplayAccessor.NEW_VOTER_SCENE:
setScene(getScene(DisplayAccessor.NEW_VOTER_SCENE)); break;
case DisplayAccessor.USER_DETAILS_ERROR_SCENE:
break;
}
}

Scene getCurrentScene(){return primaryStage.getScene();}

private Scene getScene(int sceneIndex){


return sceneList.get(sceneIndex-1);
}

int indexOfScene(Scene scene) {


int index = sceneList.indexOf(scene);
index = index<0 ? index : index+1;
return index;
}
59
private void setRoot(URL url, int rootNumber)
{ Platform.runLater(()->{
try{
getCurrentScene().setRoot(FXMLLoader.load(url));
invokeRootFunction(rootNumber);
} catch(Exception e){e.printStackTrace();}
});
}

void nextScene() {
int oldSceneIndex = indexOfScene(getCurrentScene());
int newSceneIndex = oldSceneIndex + 1;
/*@debug*/System.out.println("oldSceneIndex in nextScene: "+oldSceneIndex+"; new: "+newSceneIndex);
if(newSceneIndex >= 1 && newSceneIndex <= sceneList.size()) //range(1 - sceneCount)
setScene(sceneList.get(newSceneIndex-1)); //actual
}

void prevScene() {
int currentSceneIndex = sceneList.indexOf(getCurrentScene());
if(currentSceneIndex > 1)
setScene(sceneList.get(--currentSceneIndex));
else /*@debug*/System.out.println("no prev scene");
}

private void summarizeVoteData() throws


IOException{ ArrayList<StackPane> sPanes = new
ArrayList<>();
for(Map<String, String> voteMap: sceneFunction.getVotes(trimScenesToElect(sceneList))){
StackPane sPane = FXMLLoader.load(getClass().getResource("customfx/voteItemBox.fxml"));
((Label) sPane.lookup("#electionTitle")).setText(voteMap.get("election"));
((Label) sPane.lookup("#partyName")).setText(voteMap.get("party"));

Image partyLogo;
try{ partyLogo = new Image(DisplayAccessor.RESOURCES+"/logo/"+voteMap.get("party")+".jpg"); }
catch(IllegalArgumentException i){
partyLogo = new Image(DisplayAccessor.RESOURCES+"/logo/default.jpg");
}
((ImageView) sPane.lookup("#partyLogo")).setImage(partyLogo);
sPanes.add(sPane);
}

ListView listView = ((ListView) getCurrentScene().lookup("#partyList"));


listView.setItems(FXCollections.observableArrayList(sPanes));
}

int getSceneCount(){return sceneList.size();}

void invokeSceneFunction(int sceneIndex){

if(inFinalScenes){
if(sceneIndex == sceneList.size()-2)
try {summarizeVoteData();} catch(IOException ioe){ioe.printStackTrace();}
if(sceneIndex == sceneList.size()-1) //fingerprint reading/voting scene
60
sceneFunction.castVote(trimScenesToElect(sceneList));

61
if(sceneIndex == sceneList.size()) return;//////////////////do nothing
//sceneFunction.newVote(); //////////////////////////////////////remove this when card is implemented
}

switch(sceneIndex) {
case DisplayAccessor.ANOTHER_NEW_VOTER_SCENE: if(!
inFinalScenes) break;
Thread scene1Thread = new Thread(()->{ try {
/*
* note that when the sceneFunction.fetchUserDetails returns false,
* the program pauses and waits for the user to retract his/her card.
* This retraction reloads the voter scene, serving as a loop in any
* occurrence of error while fetchingUserDetails
*/
if(!sceneFunction.fetchUserDetails()) return; //loop till it returns true
Map<String, String> userDetails = sceneFunction.getUserDetailsMap();
initializeVoterScenes(sceneFunction.getElectionBundle(), userDetails);
DisplayAccessor.nextScene();
}
catch(Exception e){
fatalError();
e.printStackTrace();
}
}, "Scene1 - Fetch Voter Details");
scene1Thread.start();
DisplayAccessor.addSceneThread(scene1Thread);
break;

case DisplayAccessor.NEW_VOTER_SCENE:
if(inFinalScenes) break;
//inFinalScenes = true;
Thread scene3Thread = new Thread(()->{ try { if(!
sceneFunction.fetchUserDetails()) return; //loop till it returns true
Map<String, String> userDetails = sceneFunction.getUserDetailsMap();
initializeVoterScenes(sceneFunction.getElectionBundle(), userDetails);
inFinalScenes = true;
DisplayAccessor.nextScene();
}
catch(ArrayIndexOutOfBoundsException arrayException) {
arrayException.printStackTrace();
fatalError();
}
catch(Exception e){
System.out.println("Unknown error");
e.printStackTrace();
}
}, "Scene3 - Fetch Voter Details");
scene3Thread.start();
DisplayAccessor.addSceneThread(scene3Thread);
break;
//case DisplayAccessor.USER_DETAILS_ERROR_SCENE:
// sceneFunction.userDetailError(); break;
}
}

//Note: sceneX.rootIndex.fxml
void invokeRootFunction(int rootIndex) {
switch(rootIndex){
62
//scene number for particular root number

case DisplayAccessor.FETCH_RESOURCES_ROOT:
new Thread(()->{
try{
//sceneFunction.fetchElectionBundle();
sceneFunction.showStartStatus(sceneFunction.createSocketConnection());
}
catch(Exception e){e.printStackTrace();}
}, "Fetch Election Resource").start();
break;
}
}

void setResultScene(){
try {
Scene resultScene = new Scene(FXMLLoader.load(getClass().getResource("scene/results.fxml")));
resultScene.getStylesheets().add(getClass().getResource("scene/scene_style.css").toExternalForm());
StringBuilder presVoteCount = new StringBuilder();
ArrayList<StackPane> sPanes = new ArrayList<>();

if(Factory.presidentialVoteCount!=null){
Factory.presidentialVoteCount.stream().limit(3).forEach(entry->{
presVoteCount.append(String.format("%s, %d\n", entry.getKey(), entry.getValue()));

try{
StackPane sPane = FXMLLoader.load(getClass().getResource("customfx/voteItemBox.fxml"));
//sPane.setMaxHeight(80);
((Label) sPane.lookup("#electionTitle")).setText(entry.getKey());
((Label) sPane.lookup("#partyName")).setText(entry.getValue().toString());

Image partyLogo;
try{ partyLogo = new Image(DisplayAccessor.RESOURCES+"/logo/"+entry.getKey()+".jpg"); }
catch(IllegalArgumentException i){
partyLogo = new Image(DisplayAccessor.RESOURCES+"/logo/default.jpg");
}
ImageView imView = (ImageView)
sPane.lookup("#partyLogo"); imView.setFitWidth(80);
imView.setFitHeight(80);
imView.setPreserveRatio(false);
//imView.setViewport(new Rectangle2D(50,50,50,50));
imView.setImage(partyLogo);

sPanes.add(sPane);
}catch (Exception e){e.printStackTrace();}
});
ListView listView = ((ListView) resultScene.lookup("#rankedVoteList"));
listView.setItems(FXCollections.observableArrayList(sPanes));
}

StringBuilder summary = new StringBuilder();


Factory.voteSummary.forEach((election, count)->{
char[] _election = election.toCharArray();
_election[0] = String.valueOf(_election[0]).toUpperCase().toCharArray()[0];
summary.append(String.format("%-12s %7d votes\n", String.valueOf(_election), count));
});

63
//((Label)(resultScene.lookup("#presidential"))).setText(presVoteCount.toString());
((Label)(resultScene.lookup("#summary"))).setText(summary.toString());
primaryStage.setScene(resultScene);
}catch (Exception e){e.printStackTrace();}
}
private void
fatalError()
{ Platform.r
unLater(()-
>{
((Label) getCurrentScene().lookup("#prompt")).setText("fatal error,
reboot device"); getCurrentScene().lookup("#prompt").setStyle("-fx-
font-size: 25px");

//irrecoverable error by calling next scene with out of bound array index,
// so no need for retry button
//getCurrentScene().lookup("#retryButton").setVisible(true);
});
}
private List<Scene> trimScenesToElect(ArrayList<Scene> scenes){
return scenes.subList(DisplayAccessor.FINAL_VOTE_BEGIN_SCENE-1, sceneList.size()-3);
}
}

64

You might also like