PHP Classes

Calculadora Escons: Calculate elected seats using D'Hondt method

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2007-07-01 (7 years ago) RSS 2.0 feedNot enough user ratingsTotal: 282 This week: 3All time: 6,835 This week: 584Up
Version License PHP version Categories  
calculadoraescons 1.1GNU General Publi...5.0Algorithms
Description Author  

This class can be used to calculate the number of seats assigned to a party upon election results using the D'Hondt method.

It takes as parameters the number of available seats and an associative array that relates each party with the votes they received.

The class distributes the available seats using the D'Hondt method and returns an associative arrays that relates each party with the number of assigned seats that they got.

The code and the comments are in Catalan.

Innovation Award  
PHP Programming Innovation award nominee
June 2007
Number 10
The D'Hondt method is used in many countries to calculate the number of seats assigned to a party, depending on the percentage of votes that they get in elections.

This class provides an implementation of the D'Hondt method. It can be used by PHP sites that want to show on the Web the partial or final results of elections that take place on countries that use this method of assigning elected seats.

Manuel Lemos
Picture of Manel Zaera
Name: Manel Zaera <contact>
Classes: 3 packages by
Country: Spain Spain
Age: 41
All time rank: 203846 in Spain Spain
Week rank: 454 Up13 in Spain Spain Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Plain text file CalculadoraEscons.php Class Class CalculdoraEscons
Accessible without login Plain text file exemple.php Example Sample file
Accessible without login Plain text file README Doc. README

 Version Control Unique User Downloads Download Rankings  
 0%Total:282All time:6,835
 This week:3This week:584Up