If a defendant appears in court, personally or by his attorney, he shall be asked whether he admits or denies the commission of the offense alleged in the complaint. If he admits the commission of the alleged offense, the court shall accept his admission and enter a judgment against him for the amount established by §