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]
3 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]3 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
Write a class named Car that has the following fields: yearMode1. The yearModel field is an int that holds the car's year model.
Gekata [30.6K]
Skeh wkf ahfmroztdjdy
Dmgk
Ann Write a class named Car that has the following fields: yearMode1. The yearModel field is an int that holds the car's year model. make. The make field is a String object that holds the make of the car, such as "Ford" "Chevrolet", "Honda", etc. speed. The speed field is an int that holds the car's current speed. In addition, the class should have the following methods . Constructor. The constructor should accept the car's year model and make as ments. These values should be assigned to the object's yearModel and make fields. The constructor should also assign 0 to the speed field. Accessor. The appropriate accessor methods get the values stored in an object's yearModel, make, and speed fields. , accelerate. The accelerate method should add 5 to the speed field each time it is called _________. brake. The brake method should subtract 5 from the speed field each time it is called.
8 0
3 years ago
Read 2 more answers
Two electronics students are discussing static electricity and electric current. Student A says that a basic property of static
Svet_ta [14]
The answer is D. Only student B is correct. Student A is incorrect because static electricity can be detected through the principle of electrostatic induction, which will indicate if there are static electricity on the surface of an object. A device which can detect static electricity is an electroscope. Moreover, for student B, it is correct that the cause for electric current to flow is the uniform flow of free electrons.
3 0
3 years ago
The best defenses against covert channels include IDS and intrusion prevention system (IPS) and thoroughly watching all aspects
ddd [48]

Answer:

The statement is True

Explanation:

When talking about computer security, we can define covert channels as an attack on a system capable of creating a loophole for information objects transfer between various processes that would normally not allow communication under the computer security policy. Hence, the best defenses system against this kind of attack is via Intrusion Defense System and Intrusion Prevention System and relentlessly "watching all aspects of an IT infrastructure for aberrant or abnormal events of any type."

7 0
3 years ago
A conventional uniprocessor has __________ .
lys-0071 [83]

Answer:

The correct option to the following question is option (A).

Explanation:

SISD is used in the uni-processors systems which executes an individual instruction streams at a time by which we control an individual memory for the storage of data.

It is the flow or the sequence of an individual data or instructions which controlled on the systems.

Whereas SISD is different from the SMID and it is not used in the Uni-processor systems

3 0
3 years ago
What is the term for a problem in your code
Anna71 [15]

Answer:

bug

Explanation:

Bug

a problem in your code

7 0
3 years ago
Read 2 more answers
Other questions:
  • Bryan knows that it takes him fifteen minutes to drive to work, or twenty minutes if every traffic light is red on the way there
    14·2 answers
  • What is virtual memory?
    11·1 answer
  • To build a framework for security policies and controls, one can use the following approach: 1) document the concepts and princi
    12·1 answer
  • I need help ASAP Asap asap!!!
    11·1 answer
  • A horse is how much percent more powerful than a pony
    11·1 answer
  • Sam plans to use this image in artwork for a brochure about airplanes. Which principles of page layout is Sam planning to use in
    11·1 answer
  • As you are designing a site for a client, you notice that the bulleted lists do not appear when a blog is published. You look in
    6·1 answer
  • 49 points!
    14·1 answer
  • Mechanisms that can be used to rescue accident victims
    11·1 answer
  • What causes the hidden node problem in a wireless local area network (wlan)?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!