Voting Program Activity

From Foss2Serve
(Difference between revisions)
Jump to: navigation, search
m (Formatting, links to Background material)
(Comments)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{| border="1"
+
__NOTOC__
 +
 
 +
{| class="wikitable"
 
|-  
 
|-  
|'''Title''' || Voting Program Assignment
+
| '''Title''' || Voting Program Assignment
 
|-
 
|-
|'''Overview''' || The student will write a program that will implement 5 different voting strategies in individual methods motivated by exposure to the humanitarian open-source project [https://www.ushahidi.com/about Ushahidi] and general election results. The activity as presented makes use of the version control systems git and GitHub to encourage incremental software development, unit testing and documentation.
+
| '''Overview''' || The student will write a program that will implement 5 different voting strategies in individual methods motivated by exposure to the humanitarian open-source project [https://www.ushahidi.com/about Ushahidi] and general election results. The activity as presented makes use of the version control systems git and GitHub to encourage incremental software development, unit testing and documentation.
 
|-  
 
|-  
|'''Prerequisite Knowledge''' || Students should have basic knowledge in a programming language of choice (here Java is used) including variables, types, assignment, arithmetic operators, standard i/o, and selection. Students should also have basic knowledge in using version control software as an individual for backups and versions.
+
| '''Prerequisite Knowledge''' || Students should have basic knowledge in a programming language of choice (here Java is used) including variables, types, assignment, arithmetic operators, standard i/o, and selection. Students should also have basic knowledge in using version control software as an individual for backups and versions.
 
|-
 
|-
|'''Learning Objectives''' || Students will demonstrate:
+
| '''Learning Objectives''' || Students will demonstrate:
 
* if/else statements
 
* if/else statements
 
* relational operators
 
* relational operators
Line 18: Line 20:
  
 
=== Background ===
 
=== Background ===
 +
 
'''Motivational Background Material'''
 
'''Motivational Background Material'''
 
:Democratic countries such as the United States place a high value on representative government and the fair election of government officials. Inexperienced individuals often assume that elections are won by a simple majority. While this is true in some instances, there are many examples even beyond the federal election of President in the United States where other voting methods are used. In addition, to have a fair election votes must be cast and counted accurately and without undue influence on voters. Technology and computing is involved in many aspects of elections and voting in around the world. The humanitarian open source software project [https://www.ushahidi.com/about Ushahidi] develops crowdsourcing tools and began in response to post-election violence in Kenya in 2008. [https://en.wikipedia.org/wiki/Electronic_voting Electronic voting] in general and how those systems are implemented is an ever-expanding effort and discussion in the computing community.
 
:Democratic countries such as the United States place a high value on representative government and the fair election of government officials. Inexperienced individuals often assume that elections are won by a simple majority. While this is true in some instances, there are many examples even beyond the federal election of President in the United States where other voting methods are used. In addition, to have a fair election votes must be cast and counted accurately and without undue influence on voters. Technology and computing is involved in many aspects of elections and voting in around the world. The humanitarian open source software project [https://www.ushahidi.com/about Ushahidi] develops crowdsourcing tools and began in response to post-election violence in Kenya in 2008. [https://en.wikipedia.org/wiki/Electronic_voting Electronic voting] in general and how those systems are implemented is an ever-expanding effort and discussion in the computing community.
Line 35: Line 38:
 
It is very helpful to implement the assignment yourself ahead of time to make sure you understand the scaffolding rationale behind the individual deliverables.
 
It is very helpful to implement the assignment yourself ahead of time to make sure you understand the scaffolding rationale behind the individual deliverables.
  
=== Directions: ===
+
=== Directions ===
 +
 
 
You will be implementing several voting methods used in different levels of government  and determining the winner of an election for these different methods. Below is a table of the different voting methods you will implement.
 
You will be implementing several voting methods used in different levels of government  and determining the winner of an election for these different methods. Below is a table of the different voting methods you will implement.
  
{| border="1" class="wikitable"
+
{| class="wikitable"
 
! Voting Method
 
! Voting Method
 
! Short Description
 
! Short Description
Line 72: Line 76:
 
| [https://en.wikipedia.org/wiki/Cumulative_voting Wikipedia link on equal and even cumulative voting]
 
| [https://en.wikipedia.org/wiki/Cumulative_voting Wikipedia link on equal and even cumulative voting]
 
| [https://en.wikipedia.org/wiki/Cumulative_voting Peoria, Illinois]
 
| [https://en.wikipedia.org/wiki/Cumulative_voting Peoria, Illinois]
 
  
 
|}
 
|}
  
 
By the end of this programming assignment, you will have implemented the method calculateVote prompting a user for what voting method they want to use and one method that calculates each individual voting strategy, named as follows:
 
By the end of this programming assignment, you will have implemented the method calculateVote prompting a user for what voting method they want to use and one method that calculates each individual voting strategy, named as follows:
*calculatePop()
+
* int calculatePop() - returns the integer associated with the candidate that would win the election if it were run using a strict popular vote, returns -1 if there i no winner
*calculateAbsMaj()
+
* int calculateAbsMaj() - returns the integer associated with the candidate that would win the election if it were run using an absolute majority, returns -1 if there is no winner
*calculateTwoPop()
+
* int calculateTwoPop() - returns the integer associated with the candidate that would win the election if it were run using a two-round strict popular vote (highest number of votes wins), returns -1 if there is no winner
*calculateElecPop()
+
* int calculateElecPop() - returns the integer associated with the candidate that would win the election if it were run using an electoral vote with 4 electoral groups, returns -1 if there is no winner
*calculateCumulative()
+
* int calculateCumulative() - returns the integer associated with the candidate that would win the election if it were run using a cumulative voting method, returns -1 if there is no winner
  
 
Each of the above methods can be implemented without using iterative programming techniques. Because you are still learning how to handle all but the simplest data, the following methods will be provided:
 
Each of the above methods can be implemented without using iterative programming techniques. Because you are still learning how to handle all but the simplest data, the following methods will be provided:
* totalVotes() - returns the total number of votes in the current election
+
* int totalVotes() - returns the total number of votes in the current election
* voteCount(int candidateNum) - returns the raw number of votes cast in the current election for the candidate indicated by candidateNum
+
* int voteCount(int candidateNum) - returns the raw number of votes cast in the current election for the candidate indicated by candidateNum
 +
* int voteCount(int candidateNum, int electoralGroup) - returns the number of votes cast in the current election for the candidate indicated by candidateNum for the electoral group indicated by electoralGroup
  
Note that for the purpose of this assignment, each election will have a total of 7 candidates.
+
Note that for the purpose of this assignment, each election will have a total of 7 candidates, numbered 0-6 and a total of 4 electoral groups numbered 0-3.
  
=== Deliverables: ===
+
=== Deliverables ===
What will the student hand in?
+
  
=== Assessment: ===
+
The student will have a total of 3 due dates:
How will the activity be graded?
+
* Due date 1: GitHub repository will have had pull request from professor for assignment and a minimum of two commits after which the calculateVote method is calling stub routines of each of the 5 calculate methods
 +
* Due date 2: GitHub repository will have had an additional two commits after which the calculatePop(), calculateTwoPop(), and calculateCumulative() are implemented fully
 +
* Due date 3: GitHub repository will have had an additional two commits after which all methods will be implemented
 +
 
 +
 
 +
==Notes for Instructors==
 +
 
 +
=== Assessment ===
 +
* Due date 1:
 +
** Correct number of commits - 10%
 +
** JavaDoc comments on required implementation - 10%
 +
** Passes Checkstyle or equivalent style guide - 10%
 +
** Correct implementation on required code - 60%
 +
** Appropriate test cases for required code - 10%
 
   
 
   
How will learning will be measured?
+
* Due date 2:
 +
** Correct number of commits - 5%
 +
** JavaDoc comments on required implementation - 10%
 +
** Passes Checkstyle or equivalent style guide - 10%
 +
** Correct implementation on required code - 60%
 +
** Appropriate test cases for required code - 10%
 +
** Resolved issues as indicated on response to due date 1 - 5%
  
Include sample assessment questions/rubrics.
+
* Due date 3:
 +
** Correct number of commits - 5%
 +
** JavaDoc comments on required implementation - 10%
 +
** Passes Checkstyle or equivalent style guide - 10%
 +
** Correct implementation on required code - 60%
 +
** Appropriate test cases for required code - 10%
 +
** Resolved issues as indicated on response to due date 2 - 5%
  
{| border="1" class="wikitable"
+
{| class="wikitable"
 
! Criteria
 
! Criteria
 
! Level 1 (fail)
 
! Level 1 (fail)
Line 105: Line 133:
 
! Level 3 (good)
 
! Level 3 (good)
 
! Level 4 (exceptional)
 
! Level 4 (exceptional)
 +
 
|-
 
|-
| '''Criterion 1...'''
+
| '''Commit %'''
|  
+
| No commits
|  
+
| One incomplete commit
|
+
| Two commits, but incomplete
|
+
| Two complete commits
  
 
|-
 
|-
| '''Criterion 2...'''
+
| '''JavaDoc comments'''
|  
+
| non-existent or few poorly written comments
|  
+
| not all comments included, but those that are are correctly written
|  
+
| all comments included, most correctly written
|  
+
| all comments included and correctly written
  
 +
|-
 +
| '''Style Issues'''
 +
| fewer than half of the style guidelines are followed
 +
| 70% of style guidelines are followed, code is readable
 +
| 85% of style guidelines are followed, few noticeable mistakes
 +
| no style mistakes according to course style guidelines
 +
 +
|-
 +
| '''Correctness'''
 +
| less than 50% of faculty test cases covered
 +
| 70% of faculty test cases covered
 +
| 80% of faculty test cases covered
 +
| all faculty test cases covered
 +
 +
 +
|-
 +
| '''Student Test Cases'''
 +
| less than 50% of faculty test categories covered by student
 +
| 70% of faculty test cases categories covered by student
 +
| 80% of faculty test cases categories covered by student
 +
| all faculty test cases categories covered by student
 +
 +
|-
 +
| '''Resolved all indicated issues'''
 +
| less than 50% of issues
 +
| 70% of issues
 +
| 80% of issues
 +
| all issues
 
|}
 
|}
  
=== Comments: ===
+
=== Comments ===
What should the instructor know before using this activity?
+
N/A
  
What are some likely difficulties that an instructor may encounter using this activity?
+
=== Suggestions for Open Source Community ===
 +
 
 +
Suggestions for an open source community member who is working in conjunction with the instructor.
  
=== Additional Information: ===
+
=== Additional Information ===
{| border="1"
+
{| class="wikitable"
 
|-  
 
|-  
|'''ACM Knowledge Area/Knowledge Unit''' || What ACM Computing Curricula 2013 knowledge area and units does this activity cover? [[ACM_Body_of_Knowledge]]
+
| '''ACM Knowledge Area/Knowledge Unit''' || What ACM Computing Curricula 2013 knowledge area and units does this activity cover? [[ACM_Body_of_Knowledge]]
 
|-
 
|-
|'''ACM Topic''' || What specific topics are addressed? The Computing Curriucula 2013 provides a list of topics - https://www.acm.org/education/CS2013-final-report.pdf
+
| '''ACM Topic''' || What specific topics are addressed? The Computing Curriucula 2013 provides a list of topics - https://www.acm.org/education/CS2013-final-report.pdf
 
|-
 
|-
|'''Level of Difficulty''' || Is this activity easy, medium or challenging?  
+
| '''Level of Difficulty''' || Is this activity easy, medium or challenging?  
 
|-
 
|-
|'''Estimated Time to Completion''' ||  How long should it take for the student to complete the activity?
+
| '''Estimated Time to Completion''' ||  How long should it take for the student to complete the activity?
 
|-
 
|-
|'''Materials/Environment''' || What does the student need?  Internet access, IRC client, Git Hub account, LINUX machine, etc.?
+
| '''Materials/Environment''' || What does the student need?  Internet access, IRC client, Git Hub account, LINUX machine, etc.?
 
|-
 
|-
|'''Author(s)''' || Who wrote this activity?
+
| '''Author(s)''' || Dee Weikle
 
|-
 
|-
|'''Source''' || Is there another activity on which this activity is based?  If so, please provide a link to the original resource.
+
| '''Source''' || Dee Weikle
 
|-
 
|-
|'''License''' || Under which license is this material made available? (http://creativecommons.org/licenses/)
+
| '''License''' || Under which license is this material made available? (http://creativecommons.org/licenses/)
 
|}
 
|}
  
=== Suggestions for Open Source Community: ===
 
Suggestions for an open source community member who is working in conjunction with the instructor.
 
  
 
--------------------
 
--------------------
Line 155: Line 212:
 
[[File:CC_license.png]]
 
[[File:CC_license.png]]
  
[[Category: Learning_Activity]]
+
[[Category:Learning Activity]]
[[Category: LEARNING_ACTIVITY_SUBCATEGORY]]
+
[[Category:Coding and Style]]
 
+
[[Category:CS1]]
[[Category: CS1]]
+
[[Category:CS2]]
[[Category: CS2]]
+
[[Category:Ushahidi]]
 +
[[Category: Good Draft]]

Latest revision as of 18:08, 8 March 2017


Title Voting Program Assignment
Overview The student will write a program that will implement 5 different voting strategies in individual methods motivated by exposure to the humanitarian open-source project Ushahidi and general election results. The activity as presented makes use of the version control systems git and GitHub to encourage incremental software development, unit testing and documentation.
Prerequisite Knowledge Students should have basic knowledge in a programming language of choice (here Java is used) including variables, types, assignment, arithmetic operators, standard i/o, and selection. Students should also have basic knowledge in using version control software as an individual for backups and versions.
Learning Objectives Students will demonstrate:
  • if/else statements
  • relational operators
  • logical operators
  • multiple methods
  • testing coverage
  • incremental development
  • basic version control skills

Background

Motivational Background Material

Democratic countries such as the United States place a high value on representative government and the fair election of government officials. Inexperienced individuals often assume that elections are won by a simple majority. While this is true in some instances, there are many examples even beyond the federal election of President in the United States where other voting methods are used. In addition, to have a fair election votes must be cast and counted accurately and without undue influence on voters. Technology and computing is involved in many aspects of elections and voting in around the world. The humanitarian open source software project Ushahidi develops crowdsourcing tools and began in response to post-election violence in Kenya in 2008. Electronic voting in general and how those systems are implemented is an ever-expanding effort and discussion in the computing community.

Programming Background Material

Basic knowledge in how to write a program and introductory material in a programming language of choice is required. An example of the level of material required would be Chapters 1-5 of Think Java: How to Think Like a Computer Scientist by Allen Downey and Chris Mayfield.

Version Control Background Material

Basic information on version control such as that provided in the following Activities is recommended:

The rationale for this activity is to bring a social context and open source revision management exposure into a fairly traditional introductory course assignment in such a way that it meets the needs of the introductory course and begin to establish good software engineering habits in addition to providing a vision of what computing skills can be applied to in the real world.

It is very helpful to implement the assignment yourself ahead of time to make sure you understand the scaffolding rationale behind the individual deliverables.

Directions

You will be implementing several voting methods used in different levels of government and determining the winner of an election for these different methods. Below is a table of the different voting methods you will implement.

Voting Method Short Description Link to Background/Detailed Explanation Example of Use
Highest Number of Votes (Popular Vote) Candidate with the highest number of votes wins First-Past-The-Post Voting United States - most state electoral votes
Absolute Majority Candidate with the most number of votes wins but only if they have the majority of all votes Wikipedia link European Parliament
Two-Round Highest Number of Votes Voting happens in two-rounds. All candidates are in the first round - two candidates with highest number of votes then have two-person race in second round to determine winner Wikipedia link Brazilian Elections
Electoral Highest Number of Votes Voters are separated into groups that have a certain number of votes (electors) and all of the votes of a group are awarded to the candidate with a majority of the votes from that group. The the candidate with the majority of the electors (group votes) win. Comparison of Electoral vs. Popular Vote United States Electoral College
Cumulative Voting Candidates are elected in a single round of voting, but voters are given a set number of candidates they can give votes Wikipedia link on equal and even cumulative voting Peoria, Illinois

By the end of this programming assignment, you will have implemented the method calculateVote prompting a user for what voting method they want to use and one method that calculates each individual voting strategy, named as follows:

  • int calculatePop() - returns the integer associated with the candidate that would win the election if it were run using a strict popular vote, returns -1 if there i no winner
  • int calculateAbsMaj() - returns the integer associated with the candidate that would win the election if it were run using an absolute majority, returns -1 if there is no winner
  • int calculateTwoPop() - returns the integer associated with the candidate that would win the election if it were run using a two-round strict popular vote (highest number of votes wins), returns -1 if there is no winner
  • int calculateElecPop() - returns the integer associated with the candidate that would win the election if it were run using an electoral vote with 4 electoral groups, returns -1 if there is no winner
  • int calculateCumulative() - returns the integer associated with the candidate that would win the election if it were run using a cumulative voting method, returns -1 if there is no winner

Each of the above methods can be implemented without using iterative programming techniques. Because you are still learning how to handle all but the simplest data, the following methods will be provided:

  • int totalVotes() - returns the total number of votes in the current election
  • int voteCount(int candidateNum) - returns the raw number of votes cast in the current election for the candidate indicated by candidateNum
  • int voteCount(int candidateNum, int electoralGroup) - returns the number of votes cast in the current election for the candidate indicated by candidateNum for the electoral group indicated by electoralGroup

Note that for the purpose of this assignment, each election will have a total of 7 candidates, numbered 0-6 and a total of 4 electoral groups numbered 0-3.

Deliverables

The student will have a total of 3 due dates:

  • Due date 1: GitHub repository will have had pull request from professor for assignment and a minimum of two commits after which the calculateVote method is calling stub routines of each of the 5 calculate methods
  • Due date 2: GitHub repository will have had an additional two commits after which the calculatePop(), calculateTwoPop(), and calculateCumulative() are implemented fully
  • Due date 3: GitHub repository will have had an additional two commits after which all methods will be implemented


Notes for Instructors

Assessment

  • Due date 1:
    • Correct number of commits - 10%
    • JavaDoc comments on required implementation - 10%
    • Passes Checkstyle or equivalent style guide - 10%
    • Correct implementation on required code - 60%
    • Appropriate test cases for required code - 10%
  • Due date 2:
    • Correct number of commits - 5%
    • JavaDoc comments on required implementation - 10%
    • Passes Checkstyle or equivalent style guide - 10%
    • Correct implementation on required code - 60%
    • Appropriate test cases for required code - 10%
    • Resolved issues as indicated on response to due date 1 - 5%
  • Due date 3:
    • Correct number of commits - 5%
    • JavaDoc comments on required implementation - 10%
    • Passes Checkstyle or equivalent style guide - 10%
    • Correct implementation on required code - 60%
    • Appropriate test cases for required code - 10%
    • Resolved issues as indicated on response to due date 2 - 5%
Criteria Level 1 (fail) Level 2 (pass) Level 3 (good) Level 4 (exceptional)
Commit % No commits One incomplete commit Two commits, but incomplete Two complete commits
JavaDoc comments non-existent or few poorly written comments not all comments included, but those that are are correctly written all comments included, most correctly written all comments included and correctly written
Style Issues fewer than half of the style guidelines are followed 70% of style guidelines are followed, code is readable 85% of style guidelines are followed, few noticeable mistakes no style mistakes according to course style guidelines
Correctness less than 50% of faculty test cases covered 70% of faculty test cases covered 80% of faculty test cases covered all faculty test cases covered


Student Test Cases less than 50% of faculty test categories covered by student 70% of faculty test cases categories covered by student 80% of faculty test cases categories covered by student all faculty test cases categories covered by student
Resolved all indicated issues less than 50% of issues 70% of issues 80% of issues all issues

Comments

N/A

Suggestions for Open Source Community

Suggestions for an open source community member who is working in conjunction with the instructor.

Additional Information

ACM Knowledge Area/Knowledge Unit What ACM Computing Curricula 2013 knowledge area and units does this activity cover? ACM_Body_of_Knowledge
ACM Topic What specific topics are addressed? The Computing Curriucula 2013 provides a list of topics - https://www.acm.org/education/CS2013-final-report.pdf
Level of Difficulty Is this activity easy, medium or challenging?
Estimated Time to Completion How long should it take for the student to complete the activity?
Materials/Environment What does the student need? Internet access, IRC client, Git Hub account, LINUX machine, etc.?
Author(s) Dee Weikle
Source Dee Weikle
License Under which license is this material made available? (http://creativecommons.org/licenses/)



This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

CC license.png

Personal tools
Namespaces
Variants
Actions
Events
Learning Resources
HFOSS Projects
Evaluation
Navigation
Toolbox