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
11.
kodGreya [7K]

Answer:

The basic difference between finite and infinite is the number of times it runs and ends. The loop is basically a set of instructions that keeps repeating itself.

The finite loop ends after running for a finite times. This body of finite loop will stop executing after certain condition is reached. Hence the finite loop body keeps executing itself finite number of times.

An infinite loop keeps running and repeating itself endlessly.This loop never ends. This loop can be the result of an error in a program. For example when no stopping or exit condition is specified in the program.

Explanation:

Example of finite loop:

Lets take for loop as an example:

for(int i =0; i<=5; i++)

{ cout<<i<<endl; }

Now the loop starts from i=0

Next it enters the body of loop to execute the statement: cout<<i; which means that the value of i is displayed on the output screen.

This loop keeps executing until the value of i exceeds 5.

At first iteration 0 is printed on the output screen, at second iteration 1, at third iteration 2, at fourth iteration 3, fifth iteration 4, sixth iteration 5. After each of these iterations, the value of i is incremented by 1.

When 5 is printed, then at the next iteration the specified condition i.e. i<=5 gets false as the value of i now becomes 6 after incremented by 1.

So the loop stops running. So this means that loop ran for finite times and stopped after the a certain condition is reached. The output is:

0

1

2

3

4

5

Example of infinite loop:

Lets take while loop:

int i = 6;

    while (i >=5)

    {         cout<< i;

             i++;     }

In the above example, the loop will run infinite times. Here the value of i is initialized to 6. Then while loop is used which checks the condition which is the value of i is greater than or equal to 5. If the condition is true, the body of the loop starts executing which prints the value of i. Lets see what happens at each iteration:

1st iteration: i>=5 is True because i=6 and 6 is greater than 5. The program control enters the body of loop. The statement cout<<i prints 6. Next the value of i is incremented by 1 and it becomes 7.

2nd iteration: i>=5 is True because i=7 and 7 is greater than 5. The program control enters the body of loop. The statement cout<<i prints 7. Next the value of i is incremented by 1 and it becomes 8.

This loop will repeat itself infinite times and never stops as i will always have value greater than 5. So this is the example of infinite loop.

6 0
3 years ago
Describe what skills are required by the helpdesk technician for each step in a typical incident process.
LuckyWell [14K]
Not sure if this is whqat you are refering to. But here goes:<span>Typical steps in an incident process.</span>
Recieving--Incident is reported
Validating--incident verified as valid for the help desk to address
Logging--ticket entered into an incident application
Screening--determine symptoms
Prioritizing--determine importance of incident
Assigning--handle or escalate
Escalating--refering to higher level tier
Resolving--problem resolved
Closing--logging resolution and changing ticket status
Hope this helped.

4 0
3 years ago
The Smith family wants to relocate to a neighborhood with better schools before their three-year-old goes to kindergarten. They
alexdok [17]

byron is a lanlord or real estate agent

taylor is a babysitter or a maid

travis is a banking agent.

8 0
3 years ago
Read 2 more answers
write a program that reads a string from the user containing a date in the form mm/dd/yyyy. it should print the date in the form
julia-pushkina [17]

Using the knowledge in computational language in python it is possible to write a code that reads a string from the user containing a date in the form mm/dd/yyyy.

<h3>Writting the code:</h3>

<em>months_info = ['January', 'February','March','April', 'May','June', 'July','August', 'September', 'October', 'November', 'December']</em>

<em>date = input('Enter a date using the mm/dd/yyyy format ')</em>

<em>m, d, y = date.split('/')</em>

<em>m = int(m) - 1</em>

<em>name_of_month = months_info[m]</em>

<em>print('{} {}, {}'.format(name_of_month, d, y))</em>

See more about python at brainly.com/question/13437928

#SPJ1

3 0
2 years ago
Windows 10 features a storage solution called Storage Spaces. What is the name of the Storage Spaces feature that allows allocat
rewona [7]

Answer:

Data resiliency.

Explanation:

Spaces for storage may involve resilience to the information. Selecting a resiliency solution implies whether they assign capacity towards redundant details. The information resiliency choice regarding storage facilities.

Two-way mirror needs two capacity units or more. The information is engraved on both computers. Two-way mirror enables twice the volume of storage assigned to that of the storage capacity as such system capacity. This choice will prevent you against loss of a specific storage unit.

7 0
3 years ago
Other questions:
  • How can my computer catch a virus?
    13·1 answer
  • Use computer magazines and/or the internet to investigate one of these DBMSs: DB2, SQL Server, MySQL, Oracle, or Sybase. Prepare
    15·1 answer
  • Which company has experienced censorship in China?
    13·2 answers
  • Which entity might hire a computer systems analyst to help catch criminals?
    14·2 answers
  • The expression that is tested by a switch statement must have a(n) __________ value.
    12·1 answer
  • What coding language should i begin with if i'm looking to get into AI ?
    11·1 answer
  • What was the first e-commerce service
    13·1 answer
  • Which of the following is adoptable in Mindanao only?​
    5·1 answer
  • Write a static method named lowestPrice that accepts as its parameter a Scanner for an input file. The data in the Scanner repre
    10·1 answer
  • Use USB in a sentence
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!