Skip to content

prospecops/MapleVotes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

232 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Personal Project - MapleVotes

1 - Introduction

MapleVotes is proposed to be a Canadian Federal election simulation application. The application will allow for the creation of a new election, creating and adding constituencies to make up the election and the creation of candidates which will be assigned to a constituency. Each Candidate will be associated with a political party and be assigned the number of votes they received. Once the user has setup the election, they can simulate the election and receive the results of the elections including the winner and then create a brand new election with different parameters and simulate that election.

This application will be useful for anyone interested in Canadian politics that wants to simulate difference potential outcomes of the Federal election. This project is of particular interest to me due to the upcoming Federal election in fall of 2025, but also due to the likeliness of an early election.

2 - User Stories

  • As a user, I want to be able to create a new election, and add it to my list of simulated elections and specify -

    • the election name
    • total election votes received
    • list of constituencies.
    • list of political parties
    • list of candidates
    • winning political party
    • election status
  • As a user, I want to create and a new constituency to the list of constituencies in an election and specify -

    • Constituency name
    • Constituency winner
    • list of candidates in constituency
    • list of political partys in constituency
  • As a user, I want to create and a new Political Party to the list of Political Partys in an election and specify -

    • Political Party name
    • list of Party Candidates
    • number of winning candidates
    • total Party votes received
    • list of constituencies won
  • As a user I want to be able to create a candidate and add it to the list of candidates in a election and specify the-

    • candidate name
    • candidate political party
    • total candidate votes received
    • winning status
    • candidate constituency
  • As a user, I want to be able to select an election and view a list of the constituencies in that election.

  • As a user, I want to be able to select an election and view a list of the Partys in that election.

  • As a user, I want to be able to select an election and view a list of the candidates in that election.

  • As a user, I want to be able to select an Candidate and view the candidates info.

  • As a user, I want to be able to run the election (calculate results based on how the app was set up)

  • As a user, I want to be able to view the elections results after it has been run

  • As a user I want to have the option to be able to save my election simulation to a file if I choose to

  • As a user I want to be able to load my election simulation from file and resume exactly where I left off at

3 - Instructions for End User

  • You can generate the first required action related to the user story creating an election simulation, by entering the name of the election simulation upon starting the application where it prompts you "Enter the name of your simulation (e.g. Canada 2025)" and then clicking the submit button. Only one instance of the simualtion can exist.

  • You can generate the second action related to the user story, creating a new election by entering the name of an election scenario beside the label "Election Name" and selecting "Create Election". The election will be created and displayed in the display box below.

  • You can generate the third required action related to the user story, by selecting an election from the display box and clicking on Confirm selection. This will display a dialog box that will confirm which election you have selected. This election will now be the election scenario you are working with

  • You can generate the fourth required action related to the user story, by clicking on the Create political party button (not initally required since application loads already with the relevant panel displaying). Then entering the name of the political party they would like to create and clicking on Create Party. If the party name does not already exist, the party will be created and displayed in the dispaly box below

  • You can generate the fifth required action related to the user story by clicking on the Create Candidate button, this will change the panel to the create candidate party panel, you will have 4 details to go through to create the candidate including entering a name (click next), selecting a political party from the list of political partys (click confirm selection), selecting a constituency (click confirm selection), and entering the number of votes for the candidate (click create candidate).

  • You can generate the sixth action related to the user story by clicking on Filter Elections and selecting any of filter constituency or filter political party, to select a speciifc political party or constituency and then click on view candidates or view political parties to view the candidates or political parties based on the filter as applicable, the view constiteunces shows you all the constituencies.

  • You can generate the seventh action in my user story by clicking on run elections button and then selecting the run election button, the display box below it will run the election and display election details for the election you configured.

  • You can locate the visual component of my project when the application starts, at the bottom of the screen, it allows you to zoom in or out usign the buttons and pan around to see the different electoral districts represented in the election.

  • You can save the state of my application by clicking on the Save Simulation button located on the left side of the screen. A popup will confirm once it's saved.

  • You can reload the state of my application by clicking on the Load Simulation button on the left side of the screen. A popup will confirm once it's saved.

4 - Phase 4: Task 2

Fri Nov 29 16:32:40 PST 2024 Created and named Simulation Canada 2025

Fri Nov 29 16:32:50 PST 2024 Created and added election Canada NDP WInning to simulation

Fri Nov 29 16:32:56 PST 2024 Created and added Political Party Liberal to election Canada NDP WInning

Fri Nov 29 16:33:11 PST 2024 Created and added Candidate Tom to election Canada NDP WInning

Fri Nov 29 16:33:11 PST 2024 Created and added Candidate Tom to constituency Marc-Aurèle-Fortin

Fri Nov 29 16:33:11 PST 2024 Added Candidates Political Party Liberal to constituencyMarc-Aurèle-Fortin

Fri Nov 29 16:33:11 PST 2024 Created and added Candidate Tom to PoliticalParty Liberal

5 - Phase 4: Task 3

  • Based on my UML Diagram, if I could do the project again, I would make use of abstract classes, for instance, my design has a bidirectional relationship between, each of Political Party, Constituency and Candidate. Instead, I would have an abstract Election component class that Political Party, Constiteuncy and Candidate would extend, this would allow the relationships between each of the subclasses to be abstracted to the super class, and allow each of the election component subclass to focus on just their specific component. I would Also adopt the Single Responsibility to ensure my classes are responsible for one class. For instance, my election class, currently has high Coupling with several other classes. I would split up my election class to several other classes responisble for managing of candidates, political parties, constiteuncy's, voting etc. and have the election class mainly be concerned with handling the list of elections.

I would also make use of interfaces to reduce repeated code. My candidate, Political Party, and Constiteuncy class, have a lot of repeated code, I can have an interface that is implemented by these classes and then the class which manages them can utilize the same method which accepts the type of the interface to modify them, reducing repeated code. In my UI package I could have used an Abstract class, from which the various Menu classes extend. This would reduce repeated code in setting up the menu and limit each class to be concerned only with which options to displayu. In my GUI, I could reduce the need for bidirectional relationships by establishing a singleton pattern. Since only one election is selected at any time, I can use the single pattern on ConfigureElections to ensure only one and the same instance of the election is passed to subsequent GUI classes such as election controls.

About

A Canadian Federal Election Simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors