To run these tests without having OddElection.java, follow these steps: Create JUnit Test File You may have noticed that the template OddElectionTest.java does not have a main method inside it. The methods you are testing are contained within the OddElection.class file you are downloading.
![jgrasp junit jgrasp junit](https://image.slidesharecdn.com/21b552f0-56c6-42b8-a3d2-a7c81f612b7e-160523194439/95/resume-1-638.jpg)
The candidate with the highest number of votes wins. Int countPopular(int count0, int count1, int count2) Each method must return the candidate number (0, 1, or 2) of the winner (or -1 in some situations indicating no winner). The behavior of each method is outlined below.
Counting Approaches/Method SpecificationsĮach counting method takes 3 arguments: the count for candidate 0 (count0), the count for candidate 1 (count1), and the count for candidate 2 (count2).
![jgrasp junit jgrasp junit](https://cs.gmu.edu/~kauffman/cs310/jgrasp-junit/junit-4s-0.png)
You will also need to write JUnit tests that "cover" (execute) 100% of your statements. Each method will be passed three parameters and will return an integer corresponding to the winner of the election. You will implement these 4 counting approaches in four separate methods in a class called OddElection.
Jgrasp junit software#
Also of interest is the humanitarian open source software project Ushahidi which develops crowdsourcing tools and began in response to post-election violence in Kenya in 2008.īut on with our own election tools! The leaders involved want to compare strategies of unconventional ballet counting and have asked you to implement several ballot counting approaches as outlined below. While we won't get into all the details here, you might check out the wikipedia article on electronic voting.
Jgrasp junit code#
Submit code to Autolab and interpret feedback.Įlection season is upon us, and many people don't realize just how involved computers, algorithms, and network security are in this process.Write JUnit tests that cover 100% of the program.Design one or more methods to simplify the code.Use relational and logical operators in expressions.Write if statements to make decisions in a program.CS 149 Intro to Programming Fall 2021 PA 1 - Odd Election Objectives