PHP Classes

File: README

Recommend this page to a friend!
  Classes of Manel Zaera   Calculadora Escons   README   Download  
File: README
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: 17 years ago
Size: 782 bytes
 

Contents

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 http://www.gnu.org/copyleft/gpl.html