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
Ivahew [28]
3 years ago
11

(Java)Write a program that calculates and displays the conversion of an entered number of dollars into currency denominations—20

s, 10s, 5s, and 1s. Example output: $452 converted is 22 $20s, 1 $10s, 0 $5s, and 2 $1s.​
Computers and Technology
1 answer:
Nataly [62]3 years ago
8 0

Answer:

Below!

Explanation:

This is the code I have. I am not sure what I am missing that it won't accept -  

import java.util.Scanner;

class Dollars {

   public static void main(String[] args) {

            int numTwenties,numTens,numFives,numOnes,dollarAmount;  

       Scanner sc= new Scanner(System.in);

       System.out.println("Please enter a dollar amount: ");  

       dollarAmount = sc.nextInt();

        numTwenties = dollarAmount/20;

        numTens = (dollarAmount - 20*numTwenties)/10;

        numFives = (dollarAmount - (10*numTens + 20*numTwenties))/5;

        numOnes = (dollarAmount - (10*numTens + 20*numTwenties + 5*numFives));

       System.out.println(+ dollarAmount + " converted is" + numTwenties + " $20s, " + numTens + " $10s, " + numFives + " $5s, and " + numOnes + " $1s.");  

   }

}

This is what it is giving me -

Test CaseIncomplete

Dollars 598

Input598

OutputPlease enter a dollar amount: 598

598 converted is29 $20s, 1 $10s, 1 $5s, and 3 $1s.

Results

$598 converted is 29 $20s, 1 $10s, 1 $5s, and 3 $1s

Expected Output

$598 converted is 29 $20s, 1 $10s, 1 $5s, and 3 $1s

You might be interested in
A(n) ____________ is a group of similar or identical computers, connected by a high-speed network, that cooperate to provide ser
scoundrel [369]

Answer:

cluster

Explanation:

A cluster in a computer system is a collection of servers and other resources that work together to provide high reliability and, in certain situations, load balancing and parallel processing.

6 0
2 years ago
The first real computer was an abacus?
kotegsom [21]
True, false, false. Hope this helps:)
3 0
3 years ago
Do I get charged for my brainy membership before or after the 6 months
kaheart [24]
After the 6 months, the trail is for 6 months so starting the day you signed up. So exactly 6 months from that day you will be charged.
8 0
3 years ago
Read 2 more answers
Chris has just graduated from high school. He hopes to complete a carpenter's apprenticeship and eventually open his own busines
malfutka [58]
I would want to say a goal.
4 0
3 years ago
Read 2 more answers
What are the purposes of a good web page design?
zimovet [89]

Answer:

To make people interested.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • A file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that
    9·1 answer
  • To what device, inside the computer, do all other devices connect
    10·2 answers
  • Select the proper ergonomic keyboarding techniques.
    9·1 answer
  • How to select the entire table in microsoft excel
    11·1 answer
  • Sharon is thinking about opening a bakery. She knows she wants to set her own hours, reduce her stress and make a profit. But sh
    6·2 answers
  • What helps in determining the reliability of a person to repay debt?
    13·2 answers
  • What do “phone-copying” systems allow investigators to do?
    9·1 answer
  • How can you have a safe browsing experience?
    10·2 answers
  • In the program below, numA is a _____.
    8·2 answers
  • Explain input device​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!