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
In microsoft word, when you highlight existing text you want to replace you are
RSB [31]
You are changing the word
8 0
3 years ago
a ____ is a horizontal or vertical bar that appears when the contents of an area may not be visible completely on the screen.
pav-90 [236]
The answer is a Scroll bar, the description fits perfectly because you need to move it to see more of the content you are viewing, and it wont be completely. when the item does appear completely on screen then the bar is relatively large and there is  no need for scrolling, however the opposite occurs during when you cannot see all of it.
5 0
3 years ago
Andrew is researching a new operating system for the computers at his workplace. His boss wants the computers to be able to conn
Bumek [7]

Answer:

Windows 8.1 Core

Explanation:

In this particular example, we're going to use Windows 8.1 Core, is the most basic of the window's family, in this case, only we need an OS to connect the hardware with the cloud computing for security and is not necessary another license, in addition, Windows 8.1 core is easiest to use, is so friendly with the user.

6 0
3 years ago
There are four ways to create a macro? FALSE OR TRUE
Murljashka [212]

Answer: True

Explanation:

There are actually four ways to create a macro. You would want to use %let.

7 0
2 years ago
Read 2 more answers
Advantages and disadvantages of screen reading​
STatiana [176]
It can make ur eyes blind blind that’s a disadvantage
7 0
2 years ago
Read 2 more answers
Other questions:
  • _____ documentation is designed to help programmers and systems analysts understand the application software and maintain it aft
    12·1 answer
  • 1. Why is it important to compare features of a computer before making a purchase?
    13·2 answers
  • A(n) _______________ loop usually occurs when the programmer forgets to write code inside the loop that makes the test condition
    13·1 answer
  • The primary function of a __________ is to translate the URL or web address a user enters in a web browser, into the correct cor
    15·1 answer
  • During the ________ phase of the systems development life cycle process, developers construct, install, and test the components
    13·1 answer
  • Concentric circles on a disk platter where data is stored;________
    8·1 answer
  • You have a web application hosted in AWS cloud where the application logs are sent to Amazon CloudWatch. Lately, the web applica
    7·1 answer
  • What correctly describes the features of the service called kickstarter?
    14·2 answers
  • 1st answer will get brainliest!
    13·2 answers
  • What is a method that deletes an item from a list using the item’s value?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!