delivered the opinion of the court:
Leroy Finley (hereinafter defendant) brings the present appeal from a conviction for unlawful use of weapons after a jury trial. (Ill. Rev. Stat. 1977, ch. 38, par. 24 — 1.) The defendant urges that the seven-year sentence imposed by the trial court was erroneous because: (1) the prohibition against ex post facto laws barred the trial court from sentencing him to an extended term under the 1977 amendments to the Unified Code of Corrections1 (Ill. Rev. Stat., 1978 Supp., ch. 38, par. 1005 — 8—2); and (2) the sentence imposed by the trial court violated his equal protection rights.
We affirm.
The following facts are relevant to an understanding of the issues raised in this appeal. The defendant was arrested on November 20,1977, and charged with two counts of unlawful use of weapons: (1) possession of a loaded firearm within five years of release from the Illinois State Penitentiary; and (2) possession of a loaded firearm within the Chicago city limits. (Ill. Rev. Stat. 1977, ch. 38, pars. 24 — l(a)(10), 24 — 1(b).) This was a Class 3 felony. At the jury trial, it was stipulated that on October 27,
1975, the defendant pled guilty to robbery and was sentenced to a term of from two to six years at the Illinois State Penitentiary. It was further stipulated that the defendant was released on parole on July 7, 1977. Based on these stipulations and the testimony at the trial, the jury returned a verdict of guilty.
At the sentencing hearing, the trial court informed the defendant of his right to be sentenced either under the law in effect on the date of the offense (Ill. Rev. Stat. 1977, ch. 38, par. 1005 — 8—1) or under the law in effect on the date of sentencing (Ill. Rev. Stat., 1978 Supp., ch. 38, par. 1005 — 8—1). The trial court also informed the defendant that the difference between the two sentencing alternatives was that under the prior law, this offense was punishable by an indeterminate term of from one to 10 years plus one year mandatory parole, while under the amended code, the offense was punishable by an exact sentence of between two and five years. The trial court also explained that the defendant would be eligible for an extended term under the amended code because of his commission of a felony within 10 years. If this provision was applied, the defendant’s minimum sentence would be five years with a maximum term of 10 years. The defendant elected to be sentenced under the amended code and was subsequently sentenced to a term of seven years.
The defendant contends that his extended term sentence under the amended Code was improper because as he would not have been eligible for an extended term at the time the offense was committed, therefore, his sentence was based upon an ex post facto application of the extended-term provision.
In support of this argument, the defendant relies upon People v. Wyckoff (1969), 106 Ill. App. 2d 360, 245 N.E.2d 316, for the proposition that the constitutional prohibition against ex post facto laws bars sentencing a defendant under a law where the punishment for an offense has been increased after the offense has been committed. In Wyckoff, the defendant was sentenced under the misapprehension of all involved that a particular law was in effect at the time the offense was committed. The mistake altered the possible sentence range for the offense from a term of from one to 20 years to a term of from four to 20 years. On this basis, the appellate court found the sentence to be ex post facto in nature and modified the sentence to reflect the trial court’s apparent intent in sentencing.
The defendant argues that Wyckoff is factually analogous to the case at hand because in each case the minimum sentence available under the new law was higher than under the law in effect at the time the offense was committed. The State maintains that the defendant’s argument. ignores the defendant’s election to be sentenced under the amended Code. We agree. Under Illinois law, a defendant who has been charged with an offense, which is later amended prior to sentencing, must be given notice of this right to elect to be sentenced under the law in effect at the time of the offense or the law in effect at the time of sentencing. (Ill. Rev. Stat., 1978 Supp., ch. 38, par. 1008 — 2—4; People v. Hollins (1972), 51 Ill. 2d 68, 280 N.E.2d 710; People v. Gunner (1979), 73 Ill. App. 3d 533, 392 N.E.2d 165; People v. Dozier (1979), 67 Ill. App. 3d 611, 385 N.E.2d 155.) A trial court is under no obligation to inform the defendant of his sentencing alternatives prior to the election because this burden is placed upon the defendant’s attorney. (People v. Gunner; People v. Warfel (1979), 67 Ill. App. 3d 620, 385 N.E.2d 175.) Nor is a trial court required to inform the defendant of the exact sentence that he would be given under the sentencing alternatives in order for the defendant to make a knowledgeable election. (People v. Galati (1979), 75 Ill. App. 3d 860, 393 N.E.2d 744.) Moreover, it is well recognized that a defendant may not complain of the consequences of an unambiguous sentencing election. People v. Wilford (1977), 54 Ill. App. 3d 706, 270 N.E.2d 82; People v. Speller (1977), 46 Ill. App. 3d 208, 260 N.E.2d 1155; People v. Davis (1976), 36 Ill. App. 3d 904, 344 N.E.2d 736.
In Davis, the defendant claimed, as did the defendant here, that the trial court set a higher sentence, under the elected sentencing law, than was possible under the statute in effect at the time the offense was committed. It was uncontested that the defendant received the counsel of his attorney in making his election. This court concluded that the defendant had to be given the opportunity to elect under which law he wished to be sentenced, but once this decision had been made, he could not object that the sentence was improper. Unlike the defendant in People v. Wyckoff (1969), 106 Ill. App. 2d 360, 245 N.E.2d 316, the defendant here was given the opportunity to elect the law under which he would be sentenced. The record clearly indicates that the trial court more than exceeded its duty to the defendant of giving notice of his right to elect. The court carefully informed the defendant of the differences between the two statutes, including the possibility that if he chose to be sentenced under the amended Code an extended term could be imposed upon him because of his past record. The defendant does not argue that he was not eligible for the extended term but rather that he could not constitutionally be sentenced to such a term. The right of election is crucial in avoiding the prohibition against ex post facto laws because it allows the defendant to weigh the advantages and disadvantages of the sentencing alternatives and then determine which option he subjectively considers most favorable to him. This decision is particularly important where the election is between an indeterminate and determinate sentence. (People v. Davis (1976), 36 Ill. App. 3d 904, 344 N.E.2d 736.) Election does not exist, however, so that a defendant may choose the advantageous provisions of a sentencing law and then argue that the prohibition against ex post facto laws prohibits the imposition of disadvantageous provisions of the elected sentencing law. Accordingly, we cannot say that the trial court erred in sentencing the defendant to an extended term under the amended Code where defendant elected to be sentenced under that law.
The defendant next argues that his sentence to an extended term under the amended Code (Ill. Rev. Stat., 1978 Supp., ch. 38, par. 1005 — 8—2) on the basis of a pre-February 1, 1978, conviction violated his equal protection rights because sentencing under the amended Code’s other enhancement provisions, the habitual criminal provision (Ill. Rev. Stat., 1978 Supp., ch. 38, par. 33B-1), and the Class X provision (Ill. Rev. Stat., 1978 Supp., ch. 38, par. 1005 — 5—3(c)(6)) is specifically limited to post-February 1,1978, convictions. The defendant asserts that there was no rationale or reasonable basis for distinguishing between the defendants sentenced under the provisions in that these provisions were passed for the same purpose: to enhance the sentences of those convicted of felonies with prior convictions.
Equal protection does not guarantee that all persons will be treated equally. (People v. Pembrock (1976), 62 Ill. 2d 317, 342 N.E.2d 28.) Rather, as long as a legislative classification has a reasonable or rational basis the legislature is justified in treating the two groups differently. (People v. Valdez (1980), 79 Ill. 2d 74, 402 N.E.2d 187; People v. Grant (1978), 71 Ill. 2d 551, 377 N.E.2d 4; People v. Sherman (1974), 57 Ill. 2d 1, 309 N.E.2d 562.) Moreover, as long as no fundamentally protected right or suspect classification is involved, a legislative classification will be presumed valid unless the party challenging the statute proves that it is arbitrary. People v. Grammer (1976), 62 Ill. 2d 393, 342 N.E.2d 371; People v. Sherman.
The State argues that the legislature, in enacting the three aforementioned enhancement provisions, classed multiple offenders by the number and seriousness of the offenses that they committed on the rationale that their past conduct, which differed in kind and degree, justified sentences of varying severity. This justification seems reasonable and, therefore, appropriate to uphold the classification. (People v. Grammer; People v. Estes (1976), 37 Ill. App. 3d 889, 346 N.E.2d 469.) Moreover, the defendant has failed to show why, in light of these factors, the legislature was not justified in treating these offenders differently.
For the aforesaid reasons, the judgment of the circuit court of Cook County is affirmed.
Affirmed.
GOLDBERG, P. J, and O’CONNOR, J., concur.
1 Hereinafter the 1977 amendments will be referred to as the amended Code.