
602 N.W.2d 785 (1999)
STATE of Iowa, Appellee,
v.
Thomas MANN, Appellant.
No. 98-1417.
Supreme Court of Iowa.
November 17, 1999.
*787 Thomas M. Magee, Emmetsburg, for appellant.
Thomas J. Miller, Attorney General, Mary Tabor, Assistant Attorney General, and Michael L. Zenor, County Attorney, for appellee.
Considered by McGIVERIN, C.J., and LAVORATO, NEUMAN, SNELL, and TERNUS, JJ.
TERNUS, Justice.
Because the defendant, who was charged with two forcible felonies (murder and kidnapping), was seventeen when he allegedly committed these offenses, the charges were excluded from the jurisdiction of the juvenile court. See Iowa Code § 232.8(1)(c) (1997). As a consequence, upon his plea of guilty, he was sentenced as an adult. See id. Accordingly, the district court denied the defendant's request for a deferred judgment and sentenced him to serve a mandatory term of incarceration not to exceed fifty years. See id. §§ 707.3, 902.9, 902.12.
On appeal, the defendant claims that he has been denied the equal protection of the laws guaranteed by the United States and Iowa Constitutions. See U.S. Const. amend. XIV; Iowa Const. art. I, § 6. He argues there is no rational basis to distinguish between juveniles age sixteen or older, who commit forcible felonies and are tried and sentenced as adults, and juveniles ages fourteen and fifteen who are waived to adult court, but remain eligible for deferred judgments. Finding no equal protection violation, we affirm the defendant's judgment of conviction and sentence.

I. Background Facts and Proceedings.

The defendant, Thomas Mann, and several codefendants were charged with first-degree murder, see Iowa Code § 707.2, criminal gang participation, see id. § 723A.2, first-degree kidnapping, see id. §§ 710.1, .2, and conspiracy to commit a forcible felony, see id. §§ 706.1, .3. Because Mann was seventeen years old at the time of the alleged murder and kidnapping, the juvenile court did not have jurisdiction, and the charges were filed in district court. See id. § 232.8(1)(c) (providing that violations by a child age sixteen or older that constitute a forcible felony "are excluded from the jurisdiction of the juvenile court").
Mann entered into a plea bargain with the State in which he agreed to plead guilty to the offense of second-degree murder and testify truthfully whenever called *788 as a witness in the prosecution of the other defendants. In return, the State agreed to dismiss the pending charges.
Prior to sentencing, Mann filed a written request for a deferred judgment. At the sentencing hearing, the district court denied his request based on the law requiring that a juvenile such as Mann be sentenced in accordance with adult sentencing provisions. See id. (stating that a child "who is convicted of a violation excluded from the jurisdiction of the juvenile court... shall be sentenced pursuant to section[s] 124.401B, 902.9, or 903.1"); see also id. § 907.3 (stating that persons convicted of a forcible felony are not eligible for a deferred judgment). Mann was then sentenced to a term of incarceration not to exceed fifty years. See id. §§ 707.3, 902.9, 902.12 (in combination requiring that a person convicted of second-degree murder be confined for an indeterminate term of fifty years and that the person serve 100% of the maximum term).
On appeal, Mann concedes that he was not eligible for a deferred judgment under the applicable statutes. He contends, however, that the statutory classification of juveniles age sixteen and older that results in their ineligibility for a deferred judgment violates the Equal Protection Clauses of the United States and Iowa Constitutions. The State argues that Mann has waived any constitutional challenge or, alternatively, has failed to preserve error.[1] The State also asserts that the statutory scheme does not deny Mann his equal protection rights.

II. Waiver.

The State claims that Mann's guilty plea waived his right to challenge the constitutionality of the applicable sentencing statutes. It is true that a defendant who pleads guilty waives certain constitutional rights. See Boykin v. Alabama, 395 U.S. 238, 243, 89 S.Ct. 1709, 1712, 23 L.Ed.2d 274, 279 (1969). In the Boykin case, the United States Supreme Court identified three constitutional guarantees that are waived by a defendant's guilty plea: (1) the privilege against compulsory self-incrimination, see U.S. Const. amends. V, XIV; (2) the right to a jury trial, see id. amend. VI; and (3) the right to confront witnesses, see id. A review of the plea agreement signed by Mann reveals that these rights were expressly identified, and, at the plea hearing, Mann expressly waived those rights. In addition, in the written plea agreement, Mann expressly waived arraignment, time to plead, and all objections to the trial information.
In contrast, the plea agreement contains no express waiver of any constitutional challenges to the relevant sentencing statutes; rather, Mann merely acknowledged the mandatory sentence he faced.[2] Similarly, at the plea hearing, Mann acknowledged the sentence required by law, but *789 was not asked whether he waived any challenges to that sentence.
Notwithstanding the lack of an express waiver, the State contends that Mann's guilty plea, together with his written acknowledgment of the sentence that would be imposed, constitutes an implied waiver of any constitutional challenge to the sentencing statutes. Thus, we look to the nature of a guilty plea to determine the extent of the waiver of rights implicit in that plea.
Once a defendant has waived his right to a trial by pleading guilty, the State is entitled to expect finality in the conviction. See Kyle v. State, 364 N.W.2d 558, 562 (Iowa 1985). This expectation is based on the fact that a guilty plea implicitly eliminates any question of the defendant's guilt. See State v. Kobrock, 213 N.W.2d 481, 482-83 (Iowa 1973) ("When a defendant voluntarily and intelligently enters a plea of guilty ..., he acknowledges guilt[,] thereby supplying both evidence and verdict ending the controversy."). Accordingly, any constitutional challenge that would undermine the defendant's conviction, with certain exceptions not relevant here, is waived. See State v. Garner, 469 N.W.2d 698, 699 (Iowa 1991) ("By pleading guilty ..., [the defendant] waived the right to challenge those convictions on any ground not intrinsic to the pleas." (Emphasis added.)); see also State v. Delano, 161 N.W.2d 66, 73 (Iowa 1968) ("By [pleading guilty, the defendant] waived all constitutional guaranties with respect to conduct of criminal prosecution and any objections to prior proceedings which may include a violation of his rights.").
We conclude that a guilty plea does not waive challenges that do not affect the validity of the conviction. Thus, a waiver of constitutional challenges to a sentencing statute is not implicit in a defendant's guilty plea. See State v. McNeair, 88 Wash.App. 331, 944 P.2d 1099, 1100-01 (1997) (holding defendant's guilty plea did not waive his Fourteenth Amendment challenge to sentencing statute); cf. State v. Iowa Dist. Ct., 308 N.W.2d 27, 30 (Iowa 1981) (holding that guilty plea relieved State of obligation "to prove any facts necessary to support a conviction," but did not waive the requirement of proof that the defendant used a firearm, which was not an element of the offense, but which was required for imposition of a mandatory minimum sentence).
The State relies on our decision in State v. Canas, 571 N.W.2d 20 (Iowa 1997), to support its position that a waiver occurred in the case before us. In Canas, the defendant was sentenced to concurrent sentences for two drug convictions. 571 N.W.2d at 22. Subsequently, the defendant requested that the court reconsider his second sentence. Id. The court did so and suspended the second sentence, placing the defendant on probation for two years. Id. The defendant was eventually paroled and, at his request, his probation on the suspended sentence was extended. Id. The defendant later violated the terms of his parole and was returned to a correctional facility to serve the second sentence. Id. He received no credit on his second sentence for time served. Id. The defendant appealed, arguing that the court had been without authority to reconsider his second sentence. Id. We agreed that the court was without authority, but we also held that the defendant, "[h]aving requested reconsideration of his ... sentence, ... cannot now claim it was reversible error for the court to grant his request." Id. at 23.
We think this case is distinguishable from the case at hand. There is no evidence in the record that Mann requested the sentence imposed or agreed to it. The most that can be said is that he acknowledged the sentence required by law. In addition, prior to the imposition of that sentence, he objected and raised the constitutional challenge asserted here. Therefore, the Canas case is inapposite.
At oral argument the State asserted that the mandatory fifty-year sentence was *790 part of the basis of its plea bargain with the defendant, and the defendant should not be able to avoid the consequences of that plea after having received the benefits of it. As noted earlier, however, the plea agreement does not include the defendant's agreement to this sentence. The plea agreement merely reflects the parties' awareness of the sentence required by law. If the State wanted to avoid any challenge to the sentencing statutes, such an agreement should have been included in the written plea bargain. Without such an agreement, the State has merely shown its expectation that the defendant would be sentenced as required by law.
In conclusion, we hold that Mann did not expressly waive his right to challenge the statutes governing his sentencing. Additionally, Mann's guilty plea did not constitute an implied waiver of that right. Therefore, we reject the State's argument that Mann waived his constitutional challenge to section 232.8(1)(c).

III. Preservation of Error.

The State contends that Mann failed to preserve error because he did not make his constitutional challenge to the sentencing statute at the earliest opportunity. See State v. McCright, 569 N.W.2d 605 (Iowa 1997). In McCright, the defendant challenged her sentence on appeal, claiming that the legislative bill in which the sentencing statute was enacted violated the single subject requirement of article III, section 29 of the Iowa Constitution. Id. at 606. The State claimed the defendant did not preserve error on this issue because she did not raise it in the district court. Id. We stated that "[a] party challenging a statute on constitutional grounds must do so at the earliest available time in the progress of the case." Id. at 607. We concluded that "the earliest available time to challenge the statute was before sentencing in a pretrial motion under [Iowa Rule of Criminal Procedure] 10(2)." Id. at 608.
In the present case, the defendant pleaded guilty on November 4, 1997. He was sentenced on August 3, 1998. Prior to sentencing, on July 28, 1998, the defendant filed a request for a deferred judgment. On August 3, 1998, just before the scheduled sentencing hearing, he filed a supporting brief, raising the constitutional claim he asserts on appeal as a basis for his deferred-judgment request. The defendant's attorney stated at the sentencing hearing that he had alerted the county attorney to the constitutional challenge "prior to coming into the courtroom here today." The prosecutor acknowledged receipt of the motion and brief, and the sentencing judge stated that he had reviewed the motion and the brief prior to the hearing. The trial court then denied the defendant's request for a deferred judgment, implicitly rejecting the defendant's constitutional challenge to the statutory sentencing scheme for juveniles.
In determining whether error has been preserved, it is important to understand the purpose of our error-preservation rules. A helpful starting point is the underlying rationale for the general rule that issues not raised in the district court cannot be raised for the first time on appeal:
The orderly, fair and efficient administration of the adversary system requires that litigants not be permitted to present one case at trial and a different one on appeal. One reason is that the trial court's ruling on an issue may either dispose of the case or affect its future course. In addition, the requirement of error preservation gives opposing counsel notice and an opportunity to be heard on the issue and a chance to take proper corrective measures or pursue alternatives in the event of an adverse ruling.
State v. Tobin, 333 N.W.2d 842, 844 (Iowa 1983). We have cited similar reasons in support of our error-preservation rule that a constitutional challenge to a statute must be raised at the earliest opportunity. See *791 State v. Milner, 571 N.W.2d 7, 12 (Iowa 1997) (stating the purpose of the earliest-opportunity rule "is to give notice to the court and opposing counsel at a time when corrective action is still possible").
We think that in applying our error-preservation rules, we must keep their underlying purpose in mind. Here, the defendant certainly could have raised his constitutional challenge to the sentencing statutes earlier. He knew when he pleaded guilty in November of 1997 what sentencing provisions would apply and he could have filed his motion and brief then. On the other hand, his failure to do so did not undermine the goals of our error-preservation rules. Opposing counsel had advance notice of the motion and its constitutional basis; he did not object to the court's consideration of the defendant's motion or voice any disadvantage generated by the timing of the motion. The court had an opportunity to consider the motion and supporting arguments prior to the hearing, and ruled on the motion at the hearing. Nothing about the course of these proceedings would have been altered had the defendant filed his motion earlier. Under these circumstances, the goals of our error-preservation rules have been met. Cf. Milner, 571 N.W.2d at 12 (holding error was preserved when issue was raised at the earliest available opportunity and "the objectives of our error-preservation rules were accomplished"); State v. Johnson, 476 N.W.2d 330, 334 (Iowa 1991) (holding defendant failed to preserve error when his objection to the composition of the jury panel was not made until a postverdict motion in arrest of judgment, noting that the failure to object earlier deprived the court of the opportunity to take corrective action); State v. Ritchison, 223 N.W.2d 207, 214 (Iowa 1974) (rejecting constitutional challenge to statute under which defendant was charged on basis that challenge made at the close of all the evidence was not filed at the earliest opportunity). It would be exalting form over substance to hold that the defendant failed to preserve error simply because the motion could have been filed earlier, even though the objectives of our error-preservation rules were met. Consequently, we hold that the defendant adequately preserved error.

IV. Equal Protection Challenge.

A. Scope of review. We review claims that a criminal statute is unconstitutional de novo. See State v. White, 545 N.W.2d 552, 554 (Iowa 1996). Statutes are presumed to be constitutional and, therefore, the defendant bears a "heavy burden to show the statute `clearly, palpably, and without a doubt, infringes the constitution.'" Id. at 557 (quoting State v. Duncan, 414 N.W.2d 91, 95 (Iowa 1987)). "A person challenging a statute must negate every reasonable basis upon which the statute could be upheld as constitutional." Schroeder Oil Co. v. Iowa State Dep't of Revenue & Fin., 458 N.W.2d 602, 603 (Iowa 1990).
B. Nature of equal protection challenge. Pursuant to Iowa Code section 232.8(1)(c), a defendant age sixteen years or older charged with a forcible felony is excluded from the jurisdiction of the juvenile court and is subject to prosecution and sentencing as an adult.[3] An adult convicted of a forcible felony is not eligible for a deferred judgment, a deferred sentence, or a suspended sentence. See Iowa Code § 907.3.
Mann was charged with first-degree murder, a forcible felony. See id. § 702.11. Therefore, he was not subject to juvenile court jurisdiction and was prosecuted as an adult. As a consequence, when he pleaded guilty to second-degree murder, also a forcible felony, he was not eligible for a deferred judgment, and so was sentenced to an indeterminate, fifty-year *792 term of confinement. See id. § 707.3 (providing a sentence of not more than fifty-years imprisonment for conviction of second-degree murder).
The defendant contrasts his treatment with that accorded a juvenile who is at least fourteen years of age, but less than sixteen years of age, who commits a forcible felony. The juvenile court may waive such a juvenile to the district court for prosecution as an adult or as a youthful offender. See id. § 232.8(3) (Supp.1997). If convicted as an adult, the child is eligible for a deferred judgment. See id. (Supp.1997). If convicted as a youthful offender, the child's sentence is deferred and supervision of the child is transferred back to the juvenile court. See id. § 907.3A(1) (Supp.1997). If the youthful offender is returned to the jurisdiction of the district court, see id. §§ 232.54(8), .56 (Supp.1997), the district court may defer sentence or enter a sentence, which may be a suspended sentence, "[n]otwithstanding any provision of the Code which prescribes a mandatory minimum sentence for the offense committed by the youthful offender." Id. § 907.3A(3) (Supp.1997).
The defendant objects to this statutory scheme. He claims that according juveniles subject to the jurisdiction of the district court different treatment at sentencing for the same offense based on their age is arbitrary and capricious. He notes that a juvenile can be waived to district court only after a hearing at which it is determined that there are not "reasonable prospects for rehabilitating the child." Id. § 232.45(6). The defendant concludes, therefore, that any distinction between those juveniles waived into district court and older juveniles automatically within the jurisdiction of the district court is nonexistent.
C. Discussion. The Fourteenth Amendment prohibits a state from "deny[ing] to any person within its jurisdiction the equal protection of the laws." U.S. Const. amend. XIV, § 1. The Iowa Constitution similarly provides that
[a]ll laws of a general nature shall have a uniform operation; the general assembly shall not grant to any citizen, or class of citizens, privileges or immunities, which, upon the same terms shall not equally belong to all citizens.
Iowa Const. art. I, § 6. "We apply the same analysis in considering [a] state equal protection claim as we do in considering [a] federal equal protection claim." State v. Ceaser, 585 N.W.2d 192, 196 (Iowa 1998). Accordingly, our subsequent discussion is applicable to the defendant's claims under both the United States and the Iowa Constitutions.
The initial step in our consideration of this issue is to determine the applicable test. See Glowacki v. Iowa Bd. of Med. Exam'rs, 501 N.W.2d 539, 541 (Iowa 1993). Because this case does not involve a fundamental right or suspect classification, see State v. Hall, 227 N.W.2d 192, 193 (Iowa 1975), we employ the rational-basis test, see Glowacki, 501 N.W.2d at 541. "Under this standard, [section 232.8(1)(c)] is constitutional if the classification made by this statute `is a reasonable one and operates equally upon all within the class.'" Ceaser, 585 N.W.2d at 196 (quoting State v. Bell, 572 N.W.2d 910, 912 (Iowa 1997)). A classification is reasonable if it is "`based upon some apparent difference in situation or circumstances of the subjects placed within one class or the other which establishes the necessity or propriety of distinction between them.'" Id. (quoting Chicago Title Ins. Co. v. Huff, 256 N.W.2d 17, 29 (Iowa 1977)). A classification "`does not deny equal protection simply because in practice it results in some inequality; practical problems of government permit rough accommodations....'" Hall, 227 N.W.2d at 194 (quoting Lunday v. Vogelmann, 213 N.W.2d 904, 907 (Iowa 1973), overruled on other grounds by Miller v. Boone County Hosp., 394 N.W.2d 776, 781 (Iowa 1986)).
Clearly the State has a legitimate interest in holding persons responsible for their *793 criminal acts. When those acts are particularly serious, as in the case of forcible felonies, it is logical that the State would assign grave consequences to them. We have previously discussed the basis for the legislature's decision in section 232.8(1)(c) to exempt certain juvenile offenders from the jurisdiction of the juvenile court: "Having placed certain designated crimes committed by juveniles who have reached the age of sixteen within the criminal court jurisdiction, the legislature presumably thought the need for adult discipline and legal restraint was necessary in these cases." State v. Terry, 569 N.W.2d 364, 367 (Iowa 1997).
Taking this analysis one step further, it is also reasonable for the legislature to consider that while some juveniles, because of their age, should have sufficient maturity to be held responsible for their acts, younger juveniles would ordinarily not have the same level of maturity and thus should not suffer the same consequences for their acts. We have previously held under different circumstances that age is a permissible classification for the purpose of determining a defendant's culpability. See State v. Drake, 219 N.W.2d 492, 496 (Iowa 1974). In Drake, we upheld a statute making it a crime "for a male over the age of 25 years to `carnally know and abuse' a female under the age of 17 years." Id. at 493. The defendant in Drake claimed the age-based distinction, making the same act a crime when committed by a male over the age of twenty-five but not a crime when committed by a male age twenty-five or under, bore no reasonable relationship to the purpose of the statute. Id. at 495. We rejected the defendant's equal protection challenge to the statute:
We hold the legislature could reasonably decide that men beyond a certain age should have sufficient maturity and judgment to be held responsible for conduct which might be excusable in a younger person. Not all will agree this age should be fixed at 25. Sound reasons might be advanced for either side of this argument. However, determining the line which separates what is criminal from what is not lies peculiarly within the sphere of legislative discretion, and we have no right to substitute our judgment for that of the legislature unless we find the classification to be arbitrary, capricious, and without reasonable relationship to the purposes of the statute. As already indicated, we cannot reach such a conclusion here.
Id. at 496.
We think the same rational basis exists for the statute challenged by Mann. The legislature could reasonably distinguish between juveniles of different ages based on their presumed maturity and judgment, according more severe punishment to older juveniles. The fact that the juveniles who have been waived into adult court were deemed to have no reasonable prospects for rehabilitation in juvenile court does not obviate the age distinction that continues to exist between these juveniles and juveniles in the defendant's position. It is rational for the legislature to determine that younger juveniles who would not benefit from rehabilitation efforts within the juvenile court system are still less culpable than older, presumably more mature, juveniles. See generally Bell, 572 N.W.2d at 913 (noting that "legislature may treat different types of criminals differently for various purposes"). Moreover, the legislature may have believed that the mere exposure to adult court would be sufficient to "shock" younger juveniles into an attitude more receptive to rehabilitative opportunities.
As this discussion illustrates, the classification of juveniles is based upon a differenceagethat reasonably supports the propriety of distinguishing between them. Consequently, the classification is a reasonable one. Moreover, section 232.8(1)(c) operates equally upon all persons similarly situated: juveniles sixteen *794 and over who commit forcible felonies. See generally City of Cleburne v. Cleburne Living Ctr., 473 U.S. 432, 439, 105 S.Ct. 3249, 3254, 87 L.Ed.2d 313, 320 (1985) (stating that Equal Protection Clause "is essentially a direction that all persons similarly situated should be treated alike"). Because the classification made by section 232.8(1)(c) is reasonable and operates equally upon all juveniles falling within the class, it does not violate the Equal Protection Clause. Although the defendant might disagree with the lines drawn by the legislature, the legislature enjoys broad discretion "in defining the limits of classes when a statute involves classification of persons." Hall, 227 N.W.2d at 194. We conclude, therefore, that the defendant's constitutional challenge to section 232.8(1)(c) is without merit.
AFFIRMED.
NOTES
[1]  The State also makes the statement in its brief that the defendant "did not move to have jurisdiction transferred to juvenile court as provided in Iowa Code section 232.8(1)(c)." To the extent that this failure is offered as an independent reason that the court should not address the merits of Mann's constitutional challenge, we do not consider it. See Soo Line R.R. v. Iowa Dep't of Transp., 521 N.W.2d 685, 689 (Iowa 1994) (holding that random mention of an issue, without elaboration or supporting authority, is insufficient to raise issue for appellate court's consideration).
[2]  The plea agreement reads in pertinent part:

G. I know that the maximum sentence for the crime to which I am pleading guilty, as provided by statute[,] is confinement in the penitentiary or reformatory for a period of not more than 50 years.
H. I know that the mandatory minimum punishment provided by statute is that the sentence cannot be suspended and I will be incarcerated in prison for the 50-year sentence. Further § 903.12[sic] and § 903A.2, Iowa Code, provide that I must serve 100% of the 50-year term and may not be released on parole or work release, except that I may earn good conduct time of not more that 15% of my total sentence of confinement. Thus, I will be required to serve at least 42.5 years in prison before I will be eligible for any kind of release.
[3]  Even though a juvenile committing a forcible felony is initially subject to district court jurisdiction, § 232.8(1)(c) allows the court to transfer jurisdiction to the juvenile court "upon motion and for good cause."
