Write program statements to determine the fewest number of bills needed to represent a total dollar amount.
1 answer:
I guess, you ned it on Java. Check this code. I hope you'll find it helpful:
<span>
public class TRY{ </span>
public static void main(String[] args) {
<span>double MONEY, QUARTERS, DIMES, NICKELS, PENNIES; </span>
<span>int DOLLAR_100, DOLLAR_50, DOLLAR_20, DOLLAR_10, DOLLAR_5, DOLLAR_1; </span>
<span>Scanner Scan = new Scanner(System.in); </span>
<span>System.out.print("Enter the monetary amount in xx.xx: " ); </span>
<span>MONEY = Scan.nextFloat(); </span>
<span>DOLLAR_100 = (int) (MONEY / 100); </span>
<span>DOLLAR_50 = (int) (MONEY % 100 / 50); </span>
<span>DOLLAR_20 = (int) (MONEY % 100 % 50 / 20); </span>
<span>DOLLAR_10 = (int) (MONEY % 100 % 50 % 20 / 10); </span>
<span>DOLLAR_5 = (int) (MONEY % 100 % 50 % 20 % 10 / 5); </span>
<span>DOLLAR_1 = (int) (MONEY % 100 % 50 % 20 % 10 % 5); </span>
<span>QUARTERS = Math.round( (MONEY % 100 % 50 % 20 % 10 % 5 % 1 / 0.25)); </span>
<span>DIMES = Math.round((MONEY % 100 % 50 % 20 % 10 % 5 % 1 % 0.25 / 0.10)); </span>
<span>NICKELS = Math.round((MONEY % 100 % 50 % 20 % 10 % 5 % 1 % 0.25 % 0.10 / .05)); </span>
<span>PENNIES = Math.round((MONEY % 100 % 50 % 20 % 10 % 5 % 1 % 0.25 % 0.10 </span>
<span>% .05 / .01)); </span>
<span>System.out.println(DOLLAR_100 + " hundred dollar bills" ); </span>
<span>System.out.println(DOLLAR_50 + " fifty dollar bills" ); </span>
<span>System.out.println(DOLLAR_20 + " twenty dollar bills" ); </span>
<span>System.out.println(DOLLAR_10 + " ten dollar bills" ); </span>
<span>System.out.println(DOLLAR_5 + " five dollar bills" ); </span>
<span>System.out.println(DOLLAR_1 + " one dollar bills" ); </span>
<span>System.out.println((int) QUARTERS + " quarters" ); </span>
<span>System.out.println((int) DIMES + " dimes" ); </span>
<span>System.out.println((int) NICKELS + " nickels" ); </span>
<span>System.out.println((int) PENNIES + " pennies" ); </span>
<span>System.out.println("Money left after % by 100: " + MONEY % 100); </span>
<span>} </span>
<span>} </span>
You might be interested in
Computer Virus is the most common threat next fraud, hackers
I would say a computer, in this time and age everyone uses laptops, computers, chrome books for education
Answer:
"The British" are people statically from Great Britain in the UK.
Answer:
Maybe try a different charger, and if that works, your phone may have an issue..
Explanation:
Sometimes cords just.. don't work right if you use 'em long enough.
Send the icons so i can answer