Answer:
Below!
Explanation:
This is the code I have. I am not sure what I am missing that it won't accept -
import java.util.Scanner;
class Dollars {
public static void main(String[] args) {
int numTwenties,numTens,numFives,numOnes,dollarAmount;
Scanner sc= new Scanner(System.in);
System.out.println("Please enter a dollar amount: ");
dollarAmount = sc.nextInt();
numTwenties = dollarAmount/20;
numTens = (dollarAmount - 20*numTwenties)/10;
numFives = (dollarAmount - (10*numTens + 20*numTwenties))/5;
numOnes = (dollarAmount - (10*numTens + 20*numTwenties + 5*numFives));
System.out.println(+ dollarAmount + " converted is" + numTwenties + " $20s, " + numTens + " $10s, " + numFives + " $5s, and " + numOnes + " $1s.");
}
}
This is what it is giving me -
Test CaseIncomplete
Dollars 598
Input598
OutputPlease enter a dollar amount: 598
598 converted is29 $20s, 1 $10s, 1 $5s, and 3 $1s.
Results
$598 converted is 29 $20s, 1 $10s, 1 $5s, and 3 $1s
Expected Output
$598 converted is 29 $20s, 1 $10s, 1 $5s, and 3 $1s