Electronic Voting Machine Project in Java
What is electronic voting machine?
The casting and counting of ballots during elections is facilitated and automated by electronic voting machines (EVMs). It serves as an alternative to conventional voting processes based on paper. EVMs are intended to offer a safe, precise, and effective way to conduct elections.
The following elements are found in electronic voting machines:
- Voting Unit: This is the primary channel through which voters can cast their ballots. There is a list of candidates or choices for the voters to choose from in the ballot unit. For selecting candidates, it might have buttons, touchscreens, or other types of input devices.
- Control Unit: The control unit oversees how the EVM operates as a whole. It regulates the voting apparatus and makes sure that each voter can only cast one ballot. Additionally, it records and totals the votes cast for each candidate.
- Display unit: Voter information is shown to them on the display unit, including candidate names, party logos, and messages confirming their vote. To ensure accuracy and transparency in the voting process, the display unit gives the voter feedback.
- Memory Devices: To securely store the voting data, EVMs have internal memory devices. The candidate-by-candidate vote totals and other pertinent data are included in this data.
- Power supply: EVMs need a power source to function during elections, which can be provided by batteries or an external power supply.
Development of electronic voting machine
With the development of technology and the demand for secure and effective voting systems, electronic voting machines (EVMs) have changed over time. An overview of the evolution of EVMs is provided below:
- Early Mechanical Voting Machines: Mechanical voting machines have been a concept since the 19th century. These voting machines registered votes using mechanical levers, buttons, or dials. When compared to manually cast paper ballots, they provided a more practical and consistent method.
- Lever machines: Lever-based voting machines became more popular in the middle of the 20th century. According to their preferred candidates, voters would flip or pull levers, and the voting machine would mechanically record their selections. Lever machines sped up the voting process and decreased counting errors.
- Punch Card Voting Systems: Punch card voting systems first appeared in the 1960s. Voters would mark a card with holes to indicate their selections, which were then added up using specialized equipment. These systems increased accuracy and sped up the voting process.
- Direct-Recording Electronic (DRE) Voting Machines: DRE machines marked a shift to fully electronic voting systems when they were introduced in the 1980s. Voters could make their selections using a touchscreen or push-button interface on DRE machines. At the conclusion of the voting process, the machines produced instant vote tallies and stored votes electronically.
- DRE machine advancements: Over time, DRE machines have incorporated a variety of security, usability, and accessibility improvements. These included features to accommodate voters with disabilities, multiple language options, paper audit trails for verification, and encryption of the stored data.
- Voter-Verifiable Paper Audit Trails (VVPAT): Many contemporary EVMs come with VVPAT functionality to address issues with transparency and verifiability. With the help of this feature, the voter's choices are printed out on paper so they can be checked before being safely stored for auditing and recounts.
- Technological Progress: Newer, more sophisticated EVMs have been created as a result of ongoing technological advancements. These consist of block chain-based solutions to improve security and transparency, remote voting systems, and the use of biometrics for voter authentication.
It's important to note that different nations and regions have different rates of EVM development and adoption. Standards, regulations, and requirements for electronic voting systems vary across jurisdictions. The objective is to balance the electoral process's practicality, accuracy, security, and transparency.
Advantages
Several benefits of electronic voting machines over conventional paper ballots include:
- Accuracy: EVMs minimize manual counting errors and completely rule out the possibility of invalid or excessively-voted ballots.
- Efficiency: EVMs speed up the voting process by cutting down on the time needed for voting and vote counting. They can process a lot of votes in a short amount of time.
- Security: To prevent tampering, EVMs use a number of security features, including encryption, secure storage, and integrated audit trails. Additionally, they lessen the chance of multiple voting or ballot stuffing.
- Accessibility: By including elements like audio ballots or braille interfaces, EVMs can be created to accommodate voters with disabilities.
It's crucial to remember that different nations and jurisdictions use electronic voting machines in different ways. The specific characteristics, security precautions, and rules governing EVMs depend on the regional electoral laws and requirements.
Source code
import java.awt.*; import java.applet.*; import java.awt.event.*; public class Voting_System extends Applet { public int count1; public int count2; public int count3; public int count4; public int count5; public Button vote; TextField lp; TextField rp; TextField dp; TextField gp; TextField cp; public void init() { count1 = 0; count2 = 0; count3 = 0; count4 = 0; count5 = 0; this.setBackground(Color.green); setLayout(new BorderLayout()); Panel p1 =new Panel(); p1.setBackground(Color.lightGray); p1.setLayout(new GridLayout(8,2,3,2)); Checkbox ch1 =new Checkbox("Libertarian Party"); Checkbox ch2 =new Checkbox("Republican Party"); Checkbox ch3 =new Checkbox("Democratic Party"); Checkbox ch4 =new Checkbox("Green Party"); Checkbox ch5 =new Checkbox("Constitution Party"); lp = new TextField("Lp:" + String.valueOf(count1)); lp.setEditable(false); rp = new TextField("Rp:" + String.valueOf(count2)); rp.setEditable(false); dp = new TextField("Dp" + String.valueOf(count3)); dp.setEditable(false); gp = new TextField("Gp:" + String.valueOf(count4)); gp.setEditable(false); cp = new TextField("Cp:" + String.valueOf(count5)); cp.setEditable(false); handlelp lpp = new handlelp(); p1.add(ch1); ch1.addItemListener(lpp); p1.add(lp); handlerp rpp = new handlerp(); p1.add(ch2); ch2.addItemListener(rpp); p1.add(rp); handledp dpp = new handledp(); p1.add(ch3); ch3.addItemListener(dpp); p1.add(dp); handlegp gpp = new handlegp(); p1.add(ch4); ch4.addItemListener(gpp); p1.add(gp); handlecp cpp = new handlecp(); p1.add(ch5); ch5.addItemListener(cpp); p1.add(cp); add("North",p1); Label l =new Label("Choose a Party to which you want to give the vote"); Font f = new Font("Helvetica",Font.BOLD,32); l.setFont(f); add("Center",l); SingleAction sa = new SingleAction(); vote =new Button("Count number of votes"); vote.addActionListener(sa); add("South",vote); } class handlelp implements ItemListener { public void itemStateChanged(ItemEvent ie) { if(ie.getStateChange()==ItemEvent.SELECTED) count1++; } } class handlerp implements ItemListener { public void itemStateChanged(ItemEvent ie) { if(ie.getStateChange()==ItemEvent.SELECTED) ++count2; } } class handledp implements ItemListener { public void itemStateChanged(ItemEvent ie) { if(ie.getStateChange()==ItemEvent.SELECTED) ++count3; } } class handlegp implements ItemListener { public void itemStateChanged(ItemEvent ie) { if(ie.getStateChange()==ItemEvent.SELECTED) ++count4; } } class handlecp implements ItemListener { public void itemStateChanged(ItemEvent ie) { if(ie.getStateChange()==ItemEvent.SELECTED) ++count5; } } class SingleAction implements ActionListener { public void actionPerformed(ActionEvent e) { lp.setText("Lp :" + String.valueOf(count1)); rp.setText("Rp :" + String.valueOf(count2)); dp.setText("Dp :" + String.valueOf(count3)); gp.setText("Gp :" + String.valueOf(count4)); cp.setText("Cp :" + String.valueOf(count5)); } } } <html> <head> </head> <body> <applet code = "Voting_System.class" width = "780" height = "540"></applet> </body> </html>
Design of electronic voting machine
The Java design for an electronic voting machine and elaborate on each:
Candidate category
This class stands for a candidate running for office. It has attributes like voteCount (the number of votes a candidate received), party (the candidate's affiliated political party), and candidateID (a unique identifier for each candidate). For modifying and accessing these properties, the class also has getters and setters.
Voter type:
An eligible voter is represented by the Voter class. It has attributes like name (the voter's name), voterID (a special identification number for each voter), and authentication Info (data necessary for authentication, such as a password or biometric information). For these properties, the class contains getters and setters.
Authentication Manager Class
This class manages voter authentication. It offers a method called authenticate Voter that accepts two parameters: a voterID and authentication Info. With this method, the provided credentials are checked against the voter's stored data. If the authentication was successful or not, a boolean value is returned.
Class of Voting Machine:
The actual electronic voting machine is represented by the Voting Machine class. Its properties include voting Open (a boolean flag indicating whether the voting process is open or closed), voters (a list of Voter objects), and candidates (a list of Candidate objects). The class offers several techniques:
- Add a Candidate object to the list of candidates running for office using the add Candidate (candidate) method.
- startVoting(): This method activates voting by turning on the voting Open flag.
- If the voting is open and the voter has successfully completed the Authentication Manager's authentication process, the cast Vote (voterID, candidateID) method records a vote for the designated candidate by the specified voter. It ensures that a voter can only cast one vote and modifies the vote Count property of the corresponding Candidate object.
- stopVoting(): By setting the voting Open flag to false, this method ends the voting process.
- getResults(): This method returns the outcome after retrieving the vote totals for each candidate.
- reset() clears the voter and candidate lists, resets the voting Open flag, and returns the voting machine to its initial state.
Primary Class:
The entry point for operating the electronic voting machine system is the Main class, which houses the main method. It creates objects from the Authentication Manager and Voting Machine classes.