(Java)Write a program that calculates and displays the conversion of an entered number of dollars into currency denominations—20s, 10s, 5s, and 1s. Example output: $452 converted is 22 $20s, 1 $10s, 0 $5s, and 2 $1s.​

Answers

Answer 1

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

Answer 2

It's mainly the price measure with one currency against the other, even as rate changes, money through one country can get relatively weak or powerful in comparison with the other currencies, and the further program can be defined as follows:

Program Explanation:

Import package.Defining a class Conversion .Defining an integer variable "twenties, tens, fives, ones, amount, n".After defining a variable, a Scanner class object is declared that inputs value in it.In the next step, a conditional statement is declared that checks value and hold its calcuated value.At the last, a print method is declared that prints its value.

Program:

import java.util.*;//import package  

public class Conversion //defining a class Conversion

{

   public static void main(String ar[])//defining a main method

   {

       int twenties, tens, fives, ones, amount, n;//defining an integer variable

       Scanner obcdf= new Scanner(System.in);//creating Scanner class object to input value

       System.out.println("Enter amount: ");//print message

       amount = obcdf.nextInt(); //input integer value

       n =  amount; //holding innput value

       if(amount > 20)//using if block that check amount value greater than 20

       {

           twenties = (int)(amount/20); //using twenties that divides amount value by 20 and hold its integer value  

           amount = amount % 20;// holding modules value in amount variable

       }

       else  //defining else block

       {

           twenties = 0;//holding 0 in twenties variable  

       }

       if(amount > 10)//using if that check amount value greater than 10

       {

           tens = (int)(amount/10);//using tens that divides amount value by 10 and hold its integer value

           amount = amount % 10;// holding modules value in amount variable

       }

       else  //defining else block

       {

           tens = 0;//holding 0 in tens variable  

       }

       if(amount > 5)//using if that check amount value greater than 5

       {

           fives = (int)(amount/5);//using tens that divides amount value by 5 and hold its integer value

           amount = amount % 5;// holding modules value in amount variable

       }

       else //defining else block

       {

           fives = 0;//holding 0 in fives variable  

       }

       if(amount > 1)//using if that check amount value greater than 1

       {

           ones = (int) amount;//holding amount value in ones variable

       }

       else //defining else block

       {

           ones = 0;//holding 0 in ones variable

       }  

       System.out.println("$"+n+" converted is "+twenties+" $20s, "+tens+" $10s, "+fives+" $5s, and "+ones+" $1s."); //print value

   }

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/4448370

(Java)Write A Program That Calculates And Displays The Conversion Of An Entered Number Of Dollars Into

Related Questions

Could u give me brief summary of New Years

Answers

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

Answer:

happy new year friend

sorry for late..

help plz (will give brainliest)

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This is the python program in the question that is:

def sum(n1,n2):

n=n1+n2

return n

The question is: write a function CALL that displays the return value on the screen.

So, the correct program is written below:

*********************************************************************  

def sum(n1,n2):# it is function that define sum

 n=n1+n2 # variable n that store the result of n1 and n2

 return n # return the result

print(sum(3,5))# call the sum function with parameter 3 and 5 , it will print 8

print(sum(4,101))

# call the sum function with parameter 4 and 101 it will print 105

********************************************************************************

you can also store the sum result into another variable, because this function return the sum. So, you can store that return value into another vairable and using the print function, to print the value of this variable such as:

*****************************************************************************

def sum(n1,n2):# it is function that define sum

n=n1+n2 # variable n that store the result of n1 and n2

return n # return the result

result= sum(6,9) # store the sum result into another variable i.e result

print(result)# print the result variable value

*****************************************************************************

A student who might find digital learning challenging.

Answers

Digital learning exists mostly online, while traditional learning takes place in a classroom building.

Answer: it is "A"

|Likes meeting other students.|

is it just me or do people delete other peoples questions and it shows up in my inbox staying its mine

Answers

Answer:

yessss same bru.h

Explanation:

Answer:

ive had that happen before i dont know why it happens

What do the blocks in the looks category do?

Answers

Answer:

if u have a question can I see it

Explanation:

so I can know the answer choose

"Jan23" can be stored using which data type? O an alphanumeric string O a boolean operator o characters floating point numbers​

Answers

Answer:

Alphanumeric string

Explanation:

Answer:

a. an alphanumeric string

Explanation:

got it right on edge

USB 3.1 offers an improvement over its predecessors by enabling a maximum data transfer rate of up to:

Answers

Answer:

10 Gbps

Explanation:

The full form USB is Universal Serial Bus. It is used to connect to electronics as well as computers. The 3.1 USB is a recent and advance version of the USB standard. It was released in the year 2013. It can transfer data speed up to a speed of 10 Gbps.

It USB 3.1 can use the USB-C connector types and other connector types as well.

WHY DOES THIS HAPPEN!?!??!?

Answers

Answer:

whats the qeustain?

Explanation:

Can you please help me with the AP Computer Science Fill in the blank. What goes on number 5 8 and 18. I don’t understand this I need help programming.

Answers

Answer:

you can probably just delete them. what programming language is this?

Choose the term that completes the sentence.
A bubble (sort/function/search) starts by comparing the first item in the list to the rest of the items.

If the first one is greater than a later item, the items are swapped.

Answers

Answer: BUBBLE SORT

I hope I've been helpful to you.

Answer:

Sort

Explanation:

I Answered this in Edge.nuity and it was correct

how are web design & web development different from each other?

Answers

Answer:

Developers are people who build a website's core structure using coding languages, while designers are more visually creative and user-focused. Developers use their programming knowledge to breathe life into the designer’s creative vision.

You could think of developers as construction workers, and web designers as architects – both necessary, but different, skill sets.

I hope this helped :D

Explanation:

Which of the following best describes the protocol used on the internet?

Answers

Answer:

The protocols of the Internet are open and used by all devices connected to the network

Explanation:  

There are billions of devices connected to the Internet, and hundreds of different kinds of devices: laptops, tablets, phones, refrigerators, handheld credit card readers, and so on. Protocols (standards) ensure that the variety of devices interact with each other smoothly.  There are a lot of protocols! The Internet was designed with several layers of abstraction that sort the protocols according to what part of the process they support.

You’ve been tossed into an insane asylum. What do you tell the people there to prove to them that you don’t belong inside?

Answers

Was this a question on an assignment or are you in an asylum right now

An asylum is for crazy people. I'm crazy. Crazy people don't realize they're crazy. If I realize I'm crazy, then I'm not crazy. Therefore, I do not belong here.

what class are you in?
can you help me in connection?

Answers

Answer:personal computer:)

Explanation:

hey plz help, and thanks

Answers

Answer:D im pretty sure

Explanation:im sorry if get it wrong So sorry ok just sorry

D maybe??? Sorry if it’s wrong

When you open PowerPoint online, how many blank slides will appear on the screen? (5 points)
Four
One
Three
Two

Answers

Answer:

The correct answer is: One

Explanation:

PowerPoint is a software that is used to make presentations.

It is available in Microsoft office suite.

When we open PowerPoint first there are templates to choose from. After selecting blank presentation the editor window opens and it contains only one master slide/title slide

Rest slides can be added later.

Hence,

The correct answer is: One

Answer:

it isn't one it is three

Explanation:

cause i chose one and got it wrong

Submit a paragraph about how people earn income online.

Answers

Answer:

Selling services or products, generating traffic for ad revenue or investing in different types of products / companies.

Explanation:


A programmer has a need to round many numeric values to the nearest integer. Which of the following best explains the benefit of using a list as a data abstraction in this situation

Answers

Answer:

Keeping the numeric values in a list makes it easier to apply the same computation to every data element.

Explanation:

A list or array in programming is a data structure, that has the location for each item it holds indexed. It eliminates the need to constantly create a variable to compute items of the same data types.

The list can store items of the same data type and iterate over them to compute the same calculation on each of them.

Lists are values which are seperated by commas and populated within square brackets. They are mutable and values could be easily accessed, appended, deleted or replaced. Hence, the use of a list for data abstraction is beneficial in that the round function could be easily applied to all the values in the list.

Rounding the values in the list coukd be easily done using for loop which takes each value in the list one at a time, rounds them to the nearest integer and places them into another list.

Using the a python list comprehension thus:

Given a list of numeric Values :

my_list = [1.2, 1.4, 1.5, 1.7]

rounded_int = [round(x) for x in my_list]

Learn more : https://brainly.com/question/20533392

Write 5-7 sentences about your own personal observations in which you have been part of a "filter". You might have experienced this is in your Twitter feed, specific advertisements, or your search engine results. Be specific.

Answers

Answer:

Answered below.

Explanation:

I made a search for a product on an online grocery store. The search results came in and I bought the product. On subsequent visits to the grocery store website or on browsing other sites, I had special advertisements pop up. These advertisements were suggesting products to me similar to the one I bought on the grocery store. It was a targeted advertisement that had been sent based on my recent searches and purchases on the site. So I knew that was a filter.

Select four Microsoft programs.
a. Serrer
b. Visio
C. Office
d. Windows 7
e. Red Hat

Answers

Answer:

Windows, office serrear and Visio

Explanation:

Describe the history of computer in Nepal.​

Answers

Answer:

The first computer brought in Nepal was IBM 1401 which was brought by the government in lease for the population census of 1972 (2028 BS). Later in 1975 (2031 BS)YantrikSarinikaran Kendra (Electronic Data Processing Centre) was established which was later called as National Computer Centre ( NCC )

Answer:

The first computer brought in Nepal was IBM 1401 which was brought by the government in lease for the population census of 1972 (2028 BS). Later in 1975 (2031 BS)YantrikSarinikaran Kendra (Electronic Data Processing Centre) was established which was later called as National Computer Centre ( NCC )

Explanation:

if this answer is correct please make as brainlelist

Assume that x and y are boolean variables and have been properly initialized. !(x || y) || (x || y) The result of evaluating the expression above is best described as:

Answers

Answer:

The answer is "Always true "

Explanation:

Following are the program to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

bool x=true;//defining bool variable x and assign value

bool y=false;//defining bool variable y and assign value

if(!(x || y) || (x || y))//use given condition with if block

{

   cout<<"True";//print true message

}

else//defining else block

{

   cout<<"false";//print false message

}

   return 0;

}

In the above code two bool variable is declared, that hold ture and false, and used in the given expression with the condition statement, that checks the given value. In the code the logical gate OR gate that always print the true value.

Can we trust in Avast Antivirus ⊕?⊕

Answers

Answer:

yes we can

Explanation:

im also using avast antivirus and it was no fault in avast antivirus

Answer:

Avast is a good antivirus program. It is not a scam or malware. I personely use Avast a while back and they are now basically the same thing, only with a different user interface.

Explanation:

Hope It's answer you plz mark as Brainlist

Grades are numbers or ________ that show how a student performed in a course.

Answers

It’s either letters or percentages

Kris is the project manager for a large software company. Which part of project management describes the overall project in detail?

1) Analysis report

2) Resources document

3) Scope

4) Scope creep

Answers

The answer is 2), good luck.

Answer:

Scope or 3)

hope this helps

always love to be marked brainliest

can some one please help

Answers

Answer:

the thing is black for me. retake?

Explanation:

What is the answer to 4.9 Code Practice: Question 2

Answers

Answer:

sum = 0

for i in range(20, 100, 10):

sum = sum + i

Print(sum)

Explanation:

The answer to 4.9 Code Practice: Question 2 is 200  of the total output.

What is the output?

An output record that a laptop sends. Computers best paintings with virtual information. Any entry that a laptop gets have to be digitised. Often records must be transformed and returned to an analogue layout whilst it is output, as an instance the sound from a laptop's speakers.

The answer to 4.9 Code Practice: Question 2 is 200 output of all the total outputs this is the answer.

Read more about the Code :

https://brainly.com/question/3653791

#SPJ2

Which tab in MS Word would you select to insert a shape into a document? Question 6 options: Insert Review View File

Answers

Answer:

Insert

Explanation:

Under the insert tab, shapes will be an option to put in under the illustrations category.

Answer:

um insert?

Explanation:

im assuming its insert bc you said "to insert a shape into a document" so yh

i hope this helped?

help me i dont know this i suck at it

Answers

Answer:

Compiler, High level, Low level

Explanation:

I don't know about the last 2  

Why would it be useful to split up the coding for creating an app between multiple programmers? Select 2 options.

greater innovation

greater control over the code.

faster development.

greater consistency between sections of code.

Answers

Answer: c

Explanation:

Answer:

I'd be willing to wager it is A and D but not 100% sure.

Explanation:

Other Questions
La Distribuidora Industrial Dulzura va a seleccionar entre dos compaas para transportar su azcar al mercado. La primera compaa cobra 49,430.00 por alquilar los camiones ms 2,480.50 adicionales por cada tonelada de azcar. La segunda compaa cobra 60,500.00 por alquilar los camiones ms 1,927.20 adicionales por cada tonelada de azcar. I need help with this question Lucinda is saving money for a hot-air balloon trip to celebrate her graduation. She needs $300 dollars. Express this amount as an integer. Is this represented by a negative number or a positive number? Ellen takes a multiple-choice quiz that has 4 questions, with 3 answer choices for each question. What is the probability that she will get exactly 1 answer correct by guessing? Probabilities should be entered as fractions in simplest form, decimals rounded to the nearest thousandth, or percents rounded to the nearest tenth. A person pushing a bin with 45 N of force slides the 3 kg plastic bin on a rough surface with friction. The plastic bin is moving with a constant velocity. What is the net force acting on the box? What coefficient is needed to balance this equation? ____Fe + 4H2O --> Fe6O4 + 4 H2 * Activity Identify one career specialty relating to the lymphatic system and immune system and research that specialty in depth. Write a description of the specialty and explain what kinds of diseases or disorders would be diagnosed and treated by that kind of specialist. Then write whether you think that medical career would be one you'd be interested in pursuing Explain why or why not. an astronomer oberves a blue shift in the nearby Andromeda galaxy. Whatdoes that tell the astronomer.A) The galaxy is moving away from earthB) the galaxy is stationaryC) the galaxy is moving parallel to earthD) The galaxy is moving towards earth. Nightmare Land Lab Im very confused please help In which area would a unitary system work best? I need the value of X which equation is modeled Ill give BRAINLIEST just pls help :( How can mental health care continue to improve? Cube the following number A. 1B. 2C. 4D. 8 Cytosine and Thymine are chemically this type of nitrogenous base?A. PurineB. PyrimidineC. ProteinD. Nucleotide Find the original price of a pair of shoes if the sale price is $63 after a 30% discount. Of the relations graphed below, three are functions and one is not. Which of the relations is NOT a function? a. Graph A b. Graph Bc. Graph Cd. Graph D The sputum (fluid coughed up from the lungs) of many smokers contain cells with mutations in the genes for p53. The smoking-induced mutations appear to be an early signal showing that cancer of the lungs will follow. What is the likely relationship between early p53 mutation and the development of lung cancer Why might someone not like Capitalism?