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
kondor19780726 [428]
3 years ago
14

Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per l

ine. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is:
Computers and Technology
1 answer:
Paraphin [41]3 years ago
6 0
I'm assuming Java, but if you need a different language, it shouldn't be too hard to transcribe.

public void toCoins(int totalChange) {
int[] coins = new int[5] //array of coin counts
int[] values = new int[]{100, 25, 10, 5, 1}
String[] singular = new String[]{"dollar", "quarter", "dime", "nickel", "penny"};
String[] plural = new String[]{"dollars", "quarters", "dimes", "nickels", "pennies"};
for(int i = 0; i < 5; I++) {
while(totalChange > values[i]) {
totalChange -= values[i];
coins[i]++;
}
}
for(int i = 0; i < 5; i++) {
if(coins[i] == 1) System.out.println("1 " + singular[i]);
else if(coins[i] > 1) System.out.println(coins[i] + " " + plural[I]);
}


You might be interested in
You work for a large company. You need to implement a backup solution for your company that will allow you to perform multiple b
Scrat [10]

Answer:

A Tape Library

Explanation:

A tape library, sometimes called a tape silo, tape robot or tape jukebox, is a storage device that contains one or more tape drives, a number of slots to hold tape cartridges, a barcode reader to identify tape cartridges and an automated method for loading tapes. It Enables faster data migrations, reduce the complexity of and increase the frequency of backups, and streamline governance in a secure and cost-effective way.

6 0
3 years ago
If you could own a large technology Company, which one would it be and why
Lilit [14]
I would own Apple. Because I would be rich and create apple products
6 0
3 years ago
When comparison shopping, all of these hint at a good deal EXCEPT_____________________.
pav-90 [236]

Answer:

lower-priced models offer more features

Explanation:

4 0
3 years ago
24. A key on a keyboard of a computer
ira [324]

Answer:

Its A

Explanation:

.................

5 0
3 years ago
Fill in the blank: With ticket ________, you are able to edit ticket properties according to which team owns the ticket.
velikii [3]

Answer: records customization

Explanation:

7 0
2 years ago
Other questions:
  • an object or device outside the computer, that one would plug into a port to control the functions of a computer are?
    9·2 answers
  • Suppose that a machine with a 5-stage pipeline uses branch prediction. 15% of the instructions for a given test program are bran
    13·1 answer
  • Henry is sent to work with a customer at the company’s satellite branch in another town. During his visit, he notices that most
    6·1 answer
  • Advantages of purchasing a software package over developing software in-house include all of the following except ____. Group of
    13·1 answer
  • In a proper webpage, which tag holds all of a webpages visble HTML
    12·2 answers
  • PLEASE HELP!!!!
    7·1 answer
  • When approaching a bicyclist from the rear, you should slow down and
    8·1 answer
  • What is the mest gun in pixel gun 3d imma give you brainliest
    14·2 answers
  • Why do you think that network and telecommunications security careers are some of the fastest growing in the field of technology
    8·1 answer
  • Microsoft word is an example of utility software? <br><br>A.true <br>B.false​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!