Government Class Reference

The implementation of the Government. More...

Collaboration diagram for Government:

Collaboration graph
[legend]

List of all members.

Package Functions

 Government (Foundation pFoundation, GovernmentInitValues pInitValues)
 The Constructor of the Government class.
void init ()
 Initialize the Government.
void calcWage ()
 Calculate the actual wage, which depend on the average wage of the employed workers.

Private Member Functions

void calcTaxRate (double lUnemployment)
 Calculate the tax rate.

Classes

class  Probe
class  Stats


Detailed Description

The implementation of the Government.

Definition at line 35 of file Government.java.


Constructor & Destructor Documentation

Government ( Foundation  pFoundation,
GovernmentInitValues  pInitValues 
) [package]

The Constructor of the Government class.

Parameters:
pFoundation The model Foundation
pInitValues The init values of the Government

Definition at line 282 of file Government.java.

00283   {
00284     foundation = pFoundation;
00285     initValues = pInitValues;
00286   }


Member Function Documentation

void init (  )  [package]

Initialize the Government.

Definition at line 290 of file Government.java.

00290              {
00291     taxRate = 0d;
00292     money=0d;
00293     unemploymentWage = initValues.unemploymentWageQuotient * foundation.initialDesiredWage();
00294     foundation.getProbeManager().addProbe(probe);
00295     unemploymentRate = initValues.getInitUnemploymentRate();
00296     stats.init(foundation.getStepManager());
00297   }

void calcWage (  )  [package]

Calculate the actual wage, which depend on the average wage of the employed workers.

Definition at line 301 of file Government.java.

Referenced by Foundation.householdsAccounting().

00301                   {
00302     double lSumWage = 0.d;
00303     double lSumWorkAmount = 0.d;
00304     for (final Household lHousehold : foundation.getHouseholds()) {
00305       final double lWorkAmount = lHousehold.calcWorkAmount();
00306       if (lWorkAmount > 0) {
00307         lSumWage += lHousehold.calcCurrentWage();
00308         lSumWorkAmount += lWorkAmount;
00309       }
00310     }
00311 
00312     if (lSumWorkAmount > 0.d) {
00313       averageWage = (lSumWage / lSumWorkAmount);
00314       unemploymentWage = averageWage *getInitUnemploymentWageQuotient();
00315     }
00316 
00317     unemploymentRate = (foundation.getNumHouseholdsTotal() - lSumWorkAmount)
00318                         / foundation.getNumHouseholdsTotal();
00319     calcTaxRate(foundation.getNumHouseholdsTotal() - lSumWorkAmount);
00320   }

void calcTaxRate ( double  lUnemployment  )  [private]

Calculate the tax rate.

The tax rate is dividing the costs of the unemployment assurance by the total income of all employed workers.

Definition at line 332 of file Government.java.

00332                                                  {
00333     double lEarnedIncome = 0;
00334     double lInsuranceCost=0 ;
00335 
00336     for (final Household lHousehold : foundation.getHouseholds()) {
00337       lEarnedIncome += lHousehold.calcIncome();
00338       lInsuranceCost += (1-lHousehold.calcWorkAmount())*getWage();
00339     }
00340     averageIncome =lEarnedIncome / foundation.getNumHouseholdsTotal();
00341 
00342     if (FloatMath.greaterZero(lEarnedIncome)&& FloatMath.greaterZero(lInsuranceCost)) {
00343       taxRate =(lInsuranceCost-money)/ lEarnedIncome;
00344       money += taxRate*lEarnedIncome-lInsuranceCost;
00345     }
00346     else{
00347       taxRate=0;
00348     }
00349     double lTest =taxRate*lEarnedIncome-lInsuranceCost;
00350     //assert (FloatMath.approxZero(money));
00351   }


The documentation for this class was generated from the following file:
Generated on Tue Sep 14 11:11:49 2010 for lagom_generiC by  doxygen 1.5.4