ELECTION NIGHT CITS1001. Example development Understanding the problem Understanding the solution Structuring the solution Implementing the solution (Testing.

Slides:



Advertisements
Similar presentations
Electoral Systems Women and Elections
Advertisements

2 systems of voting : Plurality and Proportional representation systems BY: Destiny Cook, Jordan Burke.
Electoral Systems & Party Systems The causes and consequences of multiparty competition.
The Single Transferable Vote: Workings and Implications
Chapter 1: Methods of Voting
Muppets Use Instant Runoff Voting. Starting in the early '90s, the Henson production company started to pay the Muppets with stock options rather than.
Passport to Democracy Running the Election with Students.
Or………..  How to Vote for The Count!  Eight Forms of Voting  Unanimous Consent  Voice Vote  Rising Vote  Show of Hands  Ballot  Roll Call  By.
MAT 105 Spring  There are many more methods for determining the winner of an election with more than two candidates  We will only discuss a few.
Excursions in Modern Mathematics Sixth Edition
What is your favorite food?. Preference Schedule A Preference Schedule is a way to represent the order in which people like (prefer) certain items. The.
Social Choice Topics to be covered:
Plurality with elimination, Runoff method, Condorcet criterion.
Single Transferable Vote STV (Preferential Voting) Sometimes used when more than one option(candidate) is to be selected.
Design Example. Requirements Make a program that simulates the game of blackjack For now, we ignore money/betting…. just simulate game play But… this.
CRITERIA FOR A FAIR ELECTION
This material in not in your text (except as exercises) Sequence Comparisons –Problems in molecular biology involve finding the minimum number of edit.
Group Decision Making Y. İlker TOPCU, Ph.D twitter.com/yitopcu.
Single Transferable Vote. Multi Member Constituencies Only Voting is Preferential meaning voters indicate preference by numbers, In order of their favourite.
Democracy- Lesson 2 Different types of voting systems.
Social Choice Lecture 19 John Hey.
CPS Voting and social choice Vincent Conitzer
Slide 15-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
May 19, 2010Math 132: Foundations of Mathematics 12.5 Homework Solutions 27. (a) 28. (b) 29. (d) 30. (e) 53. Positive Correlation, Weak 54. Negative Correlation,
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Chapter 11 Hash Tables © John Urrutia 2014, All Rights Reserved1.
REPRESENTATION.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 14 Voting and Apportionment.
Determination of The Winners of 2012 Thomson Medal Award (Deadline for casting the 2 nd round vote is: 15 April, 2012 The sponsors of the top 10 candidates.
Explaining party systems The role of electoral systems.
How are Presidents Elected? Unit 10 Part 2. Electoral College – Today – New Way The electoral college elects the president – NOT THE DIRECT or “POPULAR”
1.4 The Plurality-with Elimination Method
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 15.1 Voting Methods.
E PLURIBUS HUGO “Out of the Many, a Hugo” v0.98. What does E Pluribus Hugo do? EPH is a way of tallying nominations that minimizes the effects of slates.
Student Council What is it all about? A school council does a number of things:  The school council meets - with a member of staff present -
Why a new election rule? RATIONALE Senate/Senate Council asked R&E to implement electronic balloting. To avoid multiple run-offs that at times spilled.
1 Becoming More Effective with C++ … Day Two Stanley B. Lippman
Presidential Elections
Electoral Systems and Reform How democratic is our democracy?
Warm-Up Rank the following soft drinks according to your preference (1 being the soft drink you like best and 4 being the one you like least)  Dr. Pepper.
CS12230 Introduction to Programming Extra example– More on responsibilities 1.
American Government and Organization PS1301 Tuesday, 2 November.
Determination of The Winners of 2012 Thomson Medal Award 1.The 1 st round voting will be held to select the top 9 candidates by the members of the IMSF.
Voting Theory Part II: Solutions. Proposed Solutions Approval Voting Range Voting Instant Runoff Voting Borda Count Modifications –Borda Preferendum –Quota.
Voting and Apportionment
Single Transferable Vote (STV) System -an explanation of how to allocate seats using STV By CA VISHAL LANGALIA
Voting systems in elections
Plurality with elimination, Runoff method, Condorcet criterion
Understand. Implement. Administer.
Choice Voting: Mechanics and Implications
Wrapper Classes ints, doubles, and chars are known as primitive types, or built-in types. There are no methods associated with these types of variables.
Prof. Neary Adapted from slides by Dr. Katherine Gibson
Voting systems in elections
ELECTION NIGHT CITS1001.
Let’s say we have a town of 10,000 people electing a mayor using the Plurality with Elimination Voting Method. There are 4 candidates, candidate A, candidate.
Warm Up – 1/23 - Thursday How many people voted in the election?
Social Choice Theory [Election Theory]
Classwork: p.33 (27abc run off, 29ab run off, 31, 33ab run off)
City of Cornwall, February, 2017
Voting systems Chi-Kwong Li.
Muppets Use Instant Runoff Voting
MAT 105 Fall 2008 More Voting Methods.
p.33 (28 run off, 30 run off, 32, 34ab run off)
CSE 1030: Aggregation and Composition
E PLURIBUS HUGO “Out of the Many, a Hugo” v0.92.
Chapter 5 Linked Lists © 2011 Pearson Addison-Wesley. All rights reserved.
Game Theory Day 2: More Simple Games.
Quiz – 1/24 - Friday How many people voted in the election?
Section 14.1 Voting Methods.
Boxcar and Freight Train
Presentation transcript:

ELECTION NIGHT CITS1001

Example development Understanding the problem Understanding the solution Structuring the solution Implementing the solution (Testing the solution) 2

Preferential voting An election has M candidates (we will use five candidates ABCDE in examples) N formal votes One winner, who needs N/2+1 votes to triumph Each voter returns a list of preferences for all candidates e.g. CAEDB But not CAE or CAEDA or CAXEDB or … 3

The count Discard informal votes Allocate each formal vote to its first preference candidate Then in each round of the count If the leading candidate has enough votes, Declare them the winner Otherwise, Identify the candidate X with the fewest votes Redistribute each of X’s votes to its highest-ranked surviving candidate Eliminate X 4

An example 100 votes: 12 informal, and 88 formal 88/2+1 votes = 45 required to win After the initial distribution A 11, B 14, C 29, D 25, E 9 No winner yet, so E is eliminated in Round 1 e.g. vote EABDC would be transferred to A A 17, B 16, C 29, D 26 No winner yet, so B is eliminated in Round 2 e.g. vote BEDAC would be transferred to D A 22, C 31, D 35 No winner yet, so A is eliminated in Round 3 C 47, D 41 C has enough votes to be declared the winner 5

What types of entities do we have? Votes Each vote is an expression of a voter’s preferences Candidates Each candidate collects votes until they either win or are eliminated Elections Each election represents one constituency 6

The Vote class What is the state of a Vote? The list of preferences for surviving candidates What inputs does the constructor need? The voter’s original list of preferences What accessor methods do Votes provide? Who the Vote is currently for: public char getFirstPreference(String losers) What other methods do Votes provide? A test for whether the Vote is formal: public boolean isFormal(String candidates) 7

The Candidate class What is the state of a Candidate? Their name, and their current pile of Votes What inputs does the constructor need? Their name What accessor methods do Candidates provide? getName(), getVotes(), getCount() What other methods do Candidates provide? A way of adding votes to the pile: public void addVotes(ArrayList vs, String losers) A test for whether the candidate has won: public boolean isWinner(int noOfVotes) 8

The Election class What is the state of an Election? A pile of Votes for each surviving Candidate What inputs does the constructor need? Where to get the voting papers and the candidates’ names from What accessor methods do Elections provide? None – “top-level” class Although there could be a higher class with a collection of Elections What other methods do Elections provide? The constructor could do the initial distribution A method to perform one round of the count Probably several private methods to structure the code 9

Implementation – Class Diagram 10

Implementation questions – Vote What type should the list of preferences be? If the candidates’ names are just one char each, a simple String will do Otherwise a String[] or an ArrayList, depending on… Should we delete the names of eliminated candidates, or just ignore them? We could ignore them when looking for the next preference We could delete them as needed We could delete all mentions of c at the time they are eliminated 11

Implementation questions – Candidate What type should the pile of Votes be? For most candidates, the pile will grow during the count So an ArrayList is best 12

Implementation questions – Election What type should the pile of Candidates be? Again, an ArrayList is best Should we delete eliminated Candidates, or just ignore them? We can use multiple constructors for testing: public Election(String candidates, String votes) {…} public Election(String votes) {this(“candidates.txt”, votes);} public Election() {this(“votes.txt”);} 13