answer.
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
FromTheMoon
21 day 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:
Harlamova29_29 [932]21 day ago
8 0

Answer:

Below!

Explanation:

Here’s the code I have. I’m unsure what I’m missing that prevents it from being accepted -

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.");  

   }

}

The output I’m getting is -

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
Technological improvements have allowed people to inhabit a wider variety of places more easily. Please select the best answer f
zubka84 [942]

True. Technological advances have simplified and accelerated life, making it easier for people to live in a broader range of locations. Purchasing land or a home from a developer is one example of how this facilitates obtaining a desired place.

9 0
13 days ago
Read 2 more answers
Write a method, isEmailAddress, that is passed a String argument. It returns true or false depending on whether the argument has
Amiraneli [921]

Answer:

//This method takes a parameter called myString of type String

public static boolean isEmailAddress (String myString){

//verifying if the @ character exists in the string

if (myString.indexOf("@")!= -1) {

  //ensuring that only a single instance of @ appears in the string

   if (myString.indexOf("@") == myString.lastIndexOf("@")) {

   //confirming absence of space characters

  if (myString.indexOf(" ") == -1) {

    //checking for the absence of newline characters in the string

    if (myString.indexOf("\n") == -1) {

      //checking for absence of tab characters in the string

      if (myString.indexOf("\t") == -1) {

          return true;

      }

    }

  }

}

}

 return false;

}

Explanation:

The method takes a string presumed to be an email address and verifies whether it is valid, returning true if it is valid and false otherwise. The method checks the following conditions:

->The presence of the "@" character

->Only one occurrence of "@" exists in the string

->No spaces present

->No newline characters present

->No tab characters present

Returning true only if all these conditions are met.

8 0
11 days ago
The budget process which emphasizes the achievement of goals and competition between alternatives is:
Rzqust [894]

The question offers several choices;


<span>A) </span>Incremental budgeting.
B) Performance budgeting.
C) Program budgeting.
D) Target based budgeting.


I'd argue that D is the correct option; Target based budgeting.


Target based budgeting centers on achieving objectives and competing alternatives. This budgeting approach uses pricing as a strategic tool to influence sales outcomes. It involves market research to determine the precise selling price of a product.






4 0
1 month ago
Olivia needs to get permission to use a graph of data gathered by a trade association she plans to include the graph in a report
Natasha_Volkova [897]

She can locate the copyright notice on the webpage that features the graph.

Explanation: ~Apex~

3 0
26 days ago
Read 2 more answers
Coretta is thinking about which careers she would enjoy. She considers her personal skills and interests. She enjoys reading and
8_murik_8 [892]

Answer:

zoologist

Explanation:

5 0
1 month ago
Read 2 more answers
Other questions:
  • To reduce costs and the environmental impact of commuting, your company decides to close a number of offices and to provide supp
    14·1 answer
  • Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image
    14·1 answer
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • Choose the person responsible for each innovation.
    10·1 answer
  • Here is a super challenge for you if you feel up for it. (You will need to work this out in Excel.) In 2017 the Islamic month of
    11·1 answer
  • Question #5<br> How does the computer decide which path to follow in a selection control structure?
    12·1 answer
  • explain why entrepreneurial activities are important to social development and progress of the econo​
    9·1 answer
  • Discussion Question 10: A bank in California has 13 branches spread throughout northern California , each with its own minicompu
    13·1 answer
  • Write a loop to populate the list user_guesses with a number of guesses. The variable num_guesses is the number of guesses the u
    13·1 answer
  • Allison wants to use equations to simplify the process of explaining something to the Sales team, but the default eq
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!