class CarStats
{
    static SpeedUpgrades = [ { value: 0 , cost: 0 } , 
        { value: 100 , cost: 3 } ,
        { value: 100 , cost: 5 } ,
        { value: 100 , cost: 7 } ,
        { value: 100 , cost: 9 } ,
        { value: 100 , cost: 11 } ,
        { value: 150 , cost: 13 } ,
        { value: 150 , cost: 15 } ,
        { value: 200 , cost: 20 }
    ];
    static AccelerationUpgrades = [ { value: 0 , cost: 0 } ,
        { value: 100 , cost: 3 } ,
        { value: 100 , cost: 5 } ,
        { value: 100 , cost: 7 } ,
        { value: 150 , cost: 9 } ,
        { value: 150 , cost: 11 } ,
        { value: 200 , cost: 15 }
    ];
    static RangeUpgrades = [ { value: 0 , cost: 0 } ,
        { value: 10 , cost: 3 } ,
        { value: 10 , cost: 5 } ,
        { value: 10 , cost: 7 } ,
        { value: 10 , cost: 10 } ,
        { value: 15 , cost: 14 } ,
        { value: 15 , cost: 20 }
    ];
    static CapacityUpgrades = [ { value: 0 , cost: 0 } ,
        { value: 3 , cost: 3 } , 
        { value: 3 , cost: 5 } , 
        { value: 3 , cost: 7 } , 
        { value: 3 , cost: 9 } , 
        { value: 5 , cost: 11 } , 
        { value: 5 , cost: 15 }
    ];

    constructor()
    {
        this.maxSpeed = Car.MAX_SPEED;
        this.acceleration = Car.ACCELERATION;
        this.range = Car.RANGE;
        this.capacity = Car.CAPACITY;

        this.speedRank = 0;
        this.accelerationRank = 0;
        this.rangeRank = 0;
        this.capacityRank = 0;
    }

    upgradeSpeed()
    {
        this.speedRank++;
        this.maxSpeed += CarStats.SpeedUpgrades[this.speedRank].value;
    }

    upgradeAcceleration()
    {
        this.accelerationRank++;
        this.acceleration += CarStats.AccelerationUpgrades[this.accelerationRank].value;
    }

    upgradeRange()
    {
        this.rangeRank++;
        this.range += CarStats.RangeUpgrades[this.rangeRank].value;
    }

    upgradeCapacity()
    {
        this.capacityRank++;
        this.capacity += CarStats.CapacityUpgrades[this.capacityRank].value;
    }
}