Convert totalDollars to 100-dollar bills, 10-dollar bills, and one-dollar bills, finding the maximum number of 100-dollar bills, then 10-dollar bills, then one-dollar bills.
Ex: If the input is 612, then the output is:
100-dollar bills: 6 10-dollar bills: 1 One-dollar bills: 2
Note: A 100-dollar bill is 100 one-dollar bills. A 10-dollar bill is 10 one-dollar bills.
import java.util.Scanner;
public class MoneyConverter {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int totalDollars;
int numHundreds;
int numTens;
int numOnes;
totalDollars = scnr.nextInt();
/* Your code goes here */
System.out.println("100-dollar bills: " + numHundreds);
System.out.println("10-dollar bills: " + numTens);
System.out.println("One-dollar bills: " + numOnes);
}
}