Java How do i fix these errors Public static void main Strin
Java- How do i fix these errors
Public static void main (String[] args) Scanner userlnput = new Scanner(System.in); int amount = 0; int $20 = 0; int $10 = 0; int $5 = 0; int $1 = 0; System.out.print(\"Enter the amount: \"); amount = userInput.nextInt(); if (amount > 500) {System.out.println(\"Limit of $500 exceeded!\");} else {System.out.println(\"Bills by denomination: \"); $20 = amount/20; int rest_amount = amount % 20; $10 = rest_amount/10; rest_amount = rest_amount % 10; $5 = rest_amount/5; rest_amount = rest_amount % 5; $1 = rest_amount/1; System.out.printin(\"\\t$20: \" + $20); System.out.printin(\"\\t$10: \" + $10); System.out.printin(\"\\t$5: \" + $5); System.out.printin(\"\\t$l: \" + $1); System.out.println(\"$\" + amount +\"=(\"+ $20 + \" * $20) + (\" + $10 + \" * $10) + (\" + $5 + \" * $5) + (\" + $1 + \" * $1)\");}}}Solution
//Atm.java
/*
 ^[a-z][a-zA-Z0-9]*$
 This regex describes something which starts with lowercase and the remainder
 is composed of uppercase, lowercase, and numbers
 we need to change the name of variables
 */
import java.util.Scanner;
public class Atm
 {
public static void main(String[] args)
 {
         Scanner userInput = new Scanner(System.in);
         int amount = 0;
         int dollar20 = 0;
         int dollar10 = 0;
         int dollar5 = 0;
         int dollar1 = 0;
         System.out.println(\"Enter the amount: \");
         amount = userInput.nextInt();
         if(amount > 500)
             System.out.println(\"Limit of $500 exceeded\");
         else
         {
             System.out.println(\"Bills by Denomination: \");
             dollar20 = amount/20;
             int rest_amount = amount - dollar20*20;
             dollar10 = rest_amount/10;
             rest_amount = rest_amount - dollar10*10;
             dollar5 = rest_amount/5;
             rest_amount = rest_amount - dollar5*5;
             dollar1 = rest_amount/1;
             System.out.println(\"\\t$20: \" + dollar20);
             System.out.println(\"\\t$10: \" + dollar10);
             System.out.println(\"\\t$5: \" + dollar5);
             System.out.println(\"\\t$1 \" + dollar1);
            System.out.println(\"$\" + amount + \" = [\" + dollar20 + \" + * $20] + [\" + dollar10 + \" * $10] + [\" + dollar5 + \" * $5] + [\" + dollar1 + \" * $1]\");
         }
}
}
/*
 Output:
Enter the amount:
 229
 Bills by Denomination:
    $20: 11
    $10: 0
    $5: 1
    $1 4
 $229 = [11 + * $20] + [0 * $10] + [1 * $5] + [4 * $1]
*/
![Java- How do i fix these errors Public static void main (String[] args) Scanner userlnput = new Scanner(System.in); int amount = 0; int $20 = 0; int $10 = 0; in Java- How do i fix these errors Public static void main (String[] args) Scanner userlnput = new Scanner(System.in); int amount = 0; int $20 = 0; int $10 = 0; in](/WebImages/37/java-how-do-i-fix-these-errors-public-static-void-main-strin-1112906-1761590500-0.webp)
![Java- How do i fix these errors Public static void main (String[] args) Scanner userlnput = new Scanner(System.in); int amount = 0; int $20 = 0; int $10 = 0; in Java- How do i fix these errors Public static void main (String[] args) Scanner userlnput = new Scanner(System.in); int amount = 0; int $20 = 0; int $10 = 0; in](/WebImages/37/java-how-do-i-fix-these-errors-public-static-void-main-strin-1112906-1761590500-1.webp)
