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
Tim and Eric recently started a company focused on rehabbing old houses. Before they buy a house, they use software to create an
sp2606 [1]

Answer: True

Since both partners make informed decisions about the houses before actually implementing them with information from the software

Explanation:

CAD computer aided design is the use of computers to aid in the creation, modification, analysis, or optimization of a design. CAD software is used to increase the productivity of the designer, improve the quality of design, improve communications through documentation, and to create a database for manufacturing or decision making

5 0
4 years ago
Read 2 more answers
The possibility of devices outliving a manufacturer, leaving them without long-term support against vulnerabilities is a possibl
Dafna11 [192]

Answer: Security (updating of software and hardware)

Explanation:

Internet of Things is one of the latest inventions in technology wherein smart objects and devices can connect to the internet and also share information within that space.

One of the several challenges of the Internet of Things is Security. Because of the introduction of the Internet, there is a vulnerability to hacking. Upgrades, therefore ought to be regularly provided so as to prevent hackers from recognizing patterns and hacking into them. So when the device outlives the manufacturer, there would be no one to provide regular updates thus making the device vulnerable.

8 0
4 years ago
Bob flys a drone which has a 20 megapixel camera attached, what is the definition of "megapixel in this context? Why does it mat
Verizon [17]

Answer:

megapixel refers to the unit of resolution i.e. one million

Explanation:

Interestingly the higher the pixels does not mean higher quality of image, it's more about the camera and it's sensor.

I am a photographer and a licensed drone pilot and have researched the subject to help with camera choice, both DSLR and drone.

5 0
3 years ago
A variable of type unsigned char stores a value of 255. If the variable value is decremented, what exception will occur
solmaris [256]

Answer:

No exception will occur

Explanation:

Given

Unsigned Char

Value  = 255

Operation = Decrement

Required

What type of exception occurs?

Let's assume the variable is a.

So, we have that

a = 255

The range of values of an unsigned char a is 0 to 255

So, when a is decremented by 1, the new value of a becomes 254

254 is still within the range of 0 to 255.

Hence, no exception will (or is excepted to) occur

8 0
3 years ago
Should I Ban Pog on my Discord Server
IRINA_888 [86]

Answer:

Do as you wish :)

6 0
3 years ago
Read 2 more answers
Other questions:
  • PC’s &amp; More has shifted to sales and service of laptops and PCs, where it has the potential to triple the number of its cust
    14·1 answer
  • Using the slice operator, print your first, then last name.2. Print the length of your first name.3. Assume you have two variabl
    6·1 answer
  • Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. Hint: Make use of
    10·1 answer
  • Match the fallacy with its name. Being a speaker of Spanish, I'm also great at speaking Italian.
    10·1 answer
  • Cloud computing service providers manage different computing resources based on the services they offer. Which resources do IaaS
    10·1 answer
  • Can someone help me
    12·2 answers
  • The company’s computer network is down. Who should you contact to correct this problem? Information Technology Associate Master
    12·1 answer
  • Which of the following is part of the process of publishing a website?
    7·2 answers
  • web browsers save website information in their _________, which helps the site load faster on future visits.
    11·1 answer
  • How do you select from the insertion point to the beginning of the current line?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!