Computer Science IA
Computer Science IA
(CAPE)
INTERNAL ASSESSMENT
Shanice Alexander
Kiana Cousins
Acacia King
Andrena Williams
Territory: Jamaica
ACKNOWLEDGEMENT
1|Page
Electronic Voting System
TABLE OF CONTENTS
Acknowledgement ..................................................................................................................... 1
Section 1: ................................................................................................................................... 3
Problem Definition................................................................................................................. 4
Narrative ................................................................................................................................ 6
Section 2: ................................................................................................................................... 7
Psuedocode ............................................................................................................................ 8
Section 3: ................................................................................................................................. 10
Code ..................................................................................................................................... 11
Section 4: ................................................................................................................................. 15
Section 5: ................................................................................................................................. 16
2|Page
Electronic Voting System
SECTION 1:
IDENTIFICATION OF SPECIFICATION
3|Page
Electronic Voting System
PROBLEM STATEMENT
All elections for the position of student council at Progressive High School were conducted
on paper during the academic year 2023-2024. Election paper use can be time-consuming and
PROBLEM DEFINITION
Every election held during the school year, for student council, has used conventional paper
ballots since the founding of our institution in 1932. Paper-based elections have been around
for a long time, and this has led to several serious problems. These inclhude inefficiency, the
physical space utilization, and a high demand for physical resources like paper.
We suggest creating a website and a software program to handle these issues and simplify our
school's election procedure. This program seeks to lessen the environmental impact of paper
use while improving the election system's accessibility, efficiency, and openness.
4|Page
Electronic Voting System
FUNCTIONAL REQUIREMENTS
➢ Allow candidates to input their personal information.
NON-FUNCTIONAL REQUIREMENTS
➢ Maintain data organization.
5|Page
Electronic Voting System
NARRATIVE
The code includes global variables for storing information on candidates, such as their ages,
forms, biographies, and names, as well as an array for tracking votes and a two-dimensional
array for voter identification. The program's primary functions are to register as a candidate,
vote for a candidate, access administrative features, and quit the application.
The menu function is in charge of presenting the user with a list of options, such as
'num' variable stores the user's selection. The 'candidate' function facilitates the registration of
aspiring candidates by gathering details such as: name, age, form, and reasons for the
application. Notably, there can only be five candidates in the program at a time.
Users can cast their votes, view the list of candidates, be asked for their ID numbers, and
have their vote counted by the 'voter' function. The application checks the voter's
identification to avoid duplicate votes. To gain access to administrative functions, the 'admin'
function looks for an entered password. The application shows the most recent vote totals and
The main function runs the entire program. It greets users and starts a while loop that shows
the menu 50 times or until an exit command is received. It calls the necessary functions
following the user's selection. Some of the program's restrictions include a set limit of five
candidates, an administration password that is assigned, and a set number of iterations before
the program ends. For a more appealing user experience, sleep statements are also used,
6|Page
Electronic Voting System
SECTION 2:
DESIGN
7|Page
Electronic Voting System
PSUEDOCODE
8|Page
Electronic Voting System
Declare paswrd variable and set While count is less than 50:
password Call menu () function
Prompt user to enter password and store If num is 1:
in paswrd Call candidate () function
If paswrd matches the password: Else if num is 2:
Display summary of results: If there are still available candidate
Iterate over candidates' array: slots:
If a candidate exists: Call voter () function
Display candidate's Else:
information and vote count Display voting closed message
Else: Else if num is 3:
Display incorrect password message Call admin () function
Else if num is 4:
// Main function Return 0
main (): Increment count
Declare count variable and set to 0 Return 0
Display welcome message
9|Page
Electronic Voting System
SECTION 3:
10 | P a g e
Electronic Voting System
CODE
#include<stdio.h> int candidate () {//function to display for
#include<string.h> aspiring candidates.
#include<unistd.h> sleep (1);
#define max 1000 for (int i = 0; i < 5; i++) {
#define max2 50 if(names[i][0] == '\0') {
#define max3 1300 printf("\n+++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
//global variabales ++++++++++\n");
int num; printf ("Thank you for deciding to be a part
int ages [5]; of your school body.\n");
int forms [5]; printf ("Please enter your name: ");
char bios [5] [max]; getchar ();
char names [5] [max2]; fgets (names[i], max2, stdin);
int v [5] = {0}; printf ("Enter your age: ");
char IDlist[max3][6]; scanf ("%d", &ages[i]);
printf ("And finally, your form: ");
int menu () { //function to display at the scanf ("%d", &forms[i]);
starting of the program printf ("Why do you want to be Student
printf("\n**************************** council president? ");
***********************************\ getchar ();
n"); fgets(bios[i], max, stdin);
printf ("!!!!!!!!!!!! MAIN MENU sleep (1);
!!!!!!!!!!!!!!!!"); printf ("\nYou have been successfully
printf ("\nPlease enter the number that recorded as a candidate.\n");
corresponds with your choice:"); return 0;
printf ("\n1. Register as a Candidate.\n2. }
Vote for a candidate.\n3. Administration.\n4. }
Exit Program\n"); sleep (1);
scanf ("%d", &num); printf ("\nThe maximum number of
return 0; candidates have been recorded. Thank you
} for your interest.\n");
return 0;
11 | P a g e
Electronic Voting System
} }
}
13 | P a g e
Electronic Voting System
14 | P a g e
Electronic Voting System
SECTION 4:
15 | P a g e
Electronic Voting System
SECTION 5:
DOCUMENTATION
16 | P a g e