1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leto [7]
4 years ago
11

Write program statements to determine the fewest number of bills needed to represent a total dollar amount.

Computers and Technology
1 answer:
vodomira [7]4 years ago
5 0
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
What is the most common threat on the internet? auction fraud illegal software computer viruses hackers?
Nimfa-mama [501]
Computer Virus is the most common threat next fraud, hackers
6 0
3 years ago
What is the most used piece of technology in education?
Anna11 [10]
I would say a computer, in this time and age everyone uses laptops, computers, chrome books for education
4 0
3 years ago
Who is the first British in Europe ​
Vera_Pavlovna [14]

Answer:

"The British" are people statically from Great Britain in the UK.

7 0
3 years ago
WILL GIVE BRAINLIEST!! NO LINKS!!!
anyanavicka [17]

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.

7 0
3 years ago
Read 2 more answers
Pleaseee help me with the typical situations of the icons(i already know for words but I have no idea for giving the situations
Aliun [14]
Send the icons so i can answer
4 0
2 years ago
Other questions:
  • What are three methods of sustainable farming and describe each.
    9·1 answer
  • If your vehicle leaves the pavement for any reason, remember to take your foot off the gas pedal, hold the wheel firmly, and
    12·2 answers
  • Your friends parents are worried about going over their budget for the month. Which explains would you suggest is not a need.
    14·2 answers
  • Collaboration, listening, and negotiating are considered _____ skills.
    5·1 answer
  • Baris script yang digunakan mendefinisikan website yang akan diblokir proxy server adalah
    5·1 answer
  • An outline is most like which of the following?
    6·2 answers
  • What do u mean by software​
    7·1 answer
  • Mha rp anyone? ima be baby shoto
    14·2 answers
  • What is the best use of network in homes
    15·2 answers
  • 3. What of the following is the main components of computer system?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!