Esempio n. 1
0
    static public IncomeTaxes operator+(IncomeTaxes in1, IncomeTaxes in2)
    {
        IncomeTaxes sum = new IncomeTaxes();

        sum.low    = in1.low + in2.low;
        sum.middle = in1.middle + in2.middle;
        sum.high   = in1.high + in2.high;

        return(sum);
    }
Esempio n. 2
0
    static public IncomeTaxes operator/(IncomeTaxes inc, float denominator)
    {
        IncomeTaxes result = new IncomeTaxes();

        result.low    = Mathf.RoundToInt((float)inc.low / denominator);
        result.middle = Mathf.RoundToInt((float)inc.middle / denominator);
        result.high   = Mathf.RoundToInt((float)inc.high / denominator);

        return(result);
    }
Esempio n. 3
0
    int ComputeIncomeTaxes()
    {
        IncomeTaxes incomeTaxes = new IncomeTaxes();

        //Since we already have WorkPlace classes holding both the number of workers AND the wages, we'll simply loop over them.
        //This approach would make it easier to, in the future, complexify the wage computation (leaving it to the Workplace class)

        foreach (WorkPlace workPlace in GameManager.buildingsMan.workPlaces)
        {
            foreach (Citizen employee in workPlace.Employees())
            {
                int employeeTax = incomeTaxes.AddToIncomeTaxes(employee.citizenClass, (int)workPlace.Wages(), incomeTaxRates); //AddToIncomeTaxes() returns amount that was added.
                employee.SubstractTax(employeeTax);
            }
        }

        //Update metrics
        GameManager.resourceMan.IncomeTaxes() = incomeTaxes;

        return(incomeTaxes.Sum());
    }
Esempio n. 4
0
 public void SetIncomeTaxes(IncomeTaxes newIncomeTaxes)
 {
     low    = newIncomeTaxes.low;
     middle = newIncomeTaxes.middle;
     high   = newIncomeTaxes.high;
 }