PHP Classes


Recommend this page to a friend!
  Classes of Manel Zaera  >  Calculadora Escons  >  README  >  Download  
Role: Documentation
Content type: text/plain
Description: README
Class: Calculadora Escons
Calculate elected seats using D'Hondt method
Author: By
Last change: Adapted to changes in CalculadoraEscons class
Date: 15 years ago
Size: 782 bytes


Class file image Download
CalculadoraEscons is a class that calculates the number of seats belonging to each party in an election process, using the D'Hondt's method.

To use this class you have to:

1.- Create an object:
$aCalc = new CalculadoraEscons();

2.- Call the class with the list of parties and votes collected by each of them, and the number of seats to distribute:
$aPartits = array('CiU' => 4367,'PSC' => 2252, 'ERC' => 2131,'ICV' => 403,'PP' => 287,'IPE' => 234);
$aEscons = $aCalc->calcula($aPartits,17);

The "calcula" method returns an array where the keys are the names of the parties and the values are the seats assigned to them.

2005-05-21, Manel Zaera
CalculadoraEscons is free software released under the GNU GPL license, la qual podeu consultar a
For more information send a message to info at phpclasses dot org.