(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

Debugging is finding and fixing problems in an algorithm or program. True
or False.
False
True

Answers

The correct answer is True

Debugging is finding and fixing problems in an algorithm or program is True statement.

Debugging is indeed the process of finding and fixing problems, errors, or bugs in an algorithm or computer program.

When a program does not produce the expected output or behaves unexpectedly, programmers use debugging techniques to identify and resolve the issues.

This involves analyzing the code, checking for syntax errors, logical errors, and unexpected behavior, and making the necessary corrections to ensure the program functions correctly.

Thus, the given statement is True.

Learn more about Debugging here:

https://brainly.com/question/9433559

#SPJ6

choose the type of error described. can you help me bc i don’t know??

Answers

Answer:

logic error occurs when the result is wrong...

syntax error occurs when you use the wrong punctuation...

runtime error occurs when the program starts running...

Answer:

Logic error: When the computer outputs an undesirable value due to the wrong use of operations.

Syntax error: Occurs when syntax is not used correctly in code.

Zero division error: Occurs when a value is divided by zero.

Hope this helps :)

Why does it matter if a network is set up as a LAN, or a WAN?

Answers

Answer:

A small office or business will typically only need a LAN. The local network will ensure that different files can be transferred through your office leading to a connected business environment. If you have a larger business or multiple branches, that's when you're going to need a WAN. -Google.

Answer:

A small office or business will typically only need a LAN. The local network will ensure that different files can be transferred through your office leading to a connected business environment. If you have a larger business or multiple branches, that's when you're going to need a WA

Explanation:

WILL GIVE BRAINLIEST!! If a flowchart has a diamond with the words “yes” and “no” to the sides of it, then it is representing a program that is a sequence.
true
false

Answers

Answer:

false

Explanation:

a flowchart with a diamond and with the words “yes” and “no” to the sides of it, then it is representing a program with branches.

it represents branch, like an if , else statement.

It is not in sequence.

Answer:

True

Explanation:

help me i dont understand REAL ANSWERS PLS

Answers

Answer:

it's answer is B

hope it helps you

Select the best answer from the drop-down menu. Sometimes people feel threatened by new ideas and different ways of doing things. This results in . conflict is resentment that a person is experiencing but doesn't express. conflict is the behavioral or action stage of conflict. This is often characterized by negative actions. Conflict can arise in the workplace because of personality issues, cultural differences, and .

Answers

Answer

Conflict

Latent

Manifest

Religious beliefs

Explanation:

Write a java program to read elements in an array from user and count total number of duplicate elements in array.

Answers

Answer:

Explanation:

The following code is written in Java and is a function/method that takes in an int array as a parameter. The type of array can be changed. The function then creates a counter and loops through each element in the array comparing each one, whenever one element is found to be a duplicate it increases the counter by 1 and moves on to the next element in the array. Finally, it prints out the number of duplicates.

public static int countDuplicate (int[] arr) {

               int count = 0;

               for(int i = 0; i < arr.length; i++) {

                       for(int j = i + 1; j < arr.length; j++) {

                               if(arr[i] == arr[j])

                                       count++;

                       }

               }

               return count;

       }

How will Artificial Intelligence change the way we do things? .......C-Claim:
Write a statement that responds to the question.
Your answer

Answers

Answer:

hey i hope someone will help you

What device is required to connect to the Internet?
O Wi-Fi
O an ISP
a router
a modem​

Answers

Answer:

modem

Explanation:

The primary piece of hardware you need is a modem. The type of Internet access you choose will determine the type of modem you need. Dial-up access uses a telephone modem, DSL service uses a DSL modem, cable access uses a cable modem, and satellite service uses a satellite adapter.

Answer:

D

Explanation:

Edg 2021

Which view is most often used to reorder slides in a presentation that has already been created?

Outline view
Slide Sorter view
Reading view
Normal view

Answers

Answer:

Normal view

Explanation:

The normal view is best used because it is just to drag and drop

Normal view, is most often used to reorder slides in a presentation that has already been created. Thus, option (d) is correct.

What is presentation?

The term presentation refers to the present on the information in the front of the audience. The presentation was the present the information in the short way and the face to face communicated to the audience. It was the interaction to the audience. The presentation is the two way communication.

The normal view in Microsoft PowerPoint is the default view for developing and viewing presentation slides. You'll be creating your slides in normal view, which is the editing mode, the most of the time. Unless you altered the default view, when you create or open a presentation you see it in normal mode.

As a result, the significance of the normal view is most typically used to reorder slides in a presentation that has already been created are the aforementioned. Therefore, option (d) is correct.

Learn more about on presentation, here:

https://brainly.com/question/28712294

#SPJ3

it was field day for the upper grades at Rock Creek School,
Each grade had to choose a team name and a color for their tee-shirts,
Use the clues below to figure out what each grade chose for their team name and tee-shirt color, each grade can chose one color and one team name.

- The third and fifth grades didn't choose an animal for their team name.

-The forth grade ended up with red tee-shirts with sharks on the.

-The fifth graders and tornadoes are not wearing teal.

-The bears are wearing green.

​​

Answers

Answer:

its c

Explanation:

What is globalization? O A. A constant change in weather patterns that is occurring all over the globe OB. A movement for countries to turn to an economy based on bartering C. The movement from many local economies to one economy that is global O D. The tendency for global companies to create small local businesses ​

Answers

Answer:

The movement from many local economies to one economy that is global

Explanation:

Globalization is when companies and governments from around the world come together through interaction.

help plz i need help ASAP
bhgydhusjbhhuidjs

Answers

Answer:

id.k

Explanation:

good luck

Whenever you are designing a project for commercial use (making money) and need to use photographs with people in them you must obtain a__________release.

Answers

Answer:

Copyright

Explanation:

Which sentence best describes how block-based code works?

Answers

Answer:

Block-based code is a simpler way to code.  

Explanation:

Block-based coding is a form of programming language where the developer issues instructions by dragging and dropping blocks.

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:

plzz help me with this question.........

Write a program to input a number find the sum of digits and the number of digits. Display the output

sample input - 7359
sample digits - 24
number of digits - 4​

Answers

Answer:

str = input("Enter a number: ")

sum = 0

for c in str:

   sum = sum + int(c)

print("Sample input - {}".format(str))

print("Sum of digits - {}".format(sum))

print("Number of digits - {}".format(len(str)))

Explanation:

That's python. Was that what you were looking for?

Answer Using Java :-

import java.util.*;

public class Digit

{

public static void main(String args[ ] )

{

Scanner in=new Scanner (System.in)

System.out.print("Enter a number: ");

int n = in.nextInt();

int sum = 0, count = 0;

while (n!=0)

{

int d = n % 10;

sum + = d;

count++;

n /= 10;

}

System.out.println("Sum of digits=" +sum);

System.out.println("Number of digits=" +count);

}

}

Which scenarios are examples of students managing their time well? Check all that apply. A student studies while watching her favorite television shows. A student sets aside time to study every afternoon at his desk. O A student writes down some goals that she hopes to achieve in school. A student drafts a study schedule that includes breaks. A student uses her desk calendar to record the due dates for her homework assignments. O A student rushes through his homework while sending text messages to friends. 3). Intro​

Answers

Answer:

b,c,d, and e

Explanation:

Hope this helps

Answer:

BCDE

Explanation:

EDG 2021

Using 20 sentences, as a student, why is it important to identify risk and hazard inside kitchen and home and business properties?

Answers

Answer:

The answer is below

Explanation:

Hazard is something or condition that can cause injury to individuals. If properties are not managed appropriately, the hazard can be inevitable. Every hazard comes with its own risk. And Risk of hazard is the degree to which hazard can affect individuals when exposed to hazards.

Identifying hazards in the surrounding are essential. Also, identifying the risk associated with hazards can't be overemphasized. Hence, the need to identifying both the hazards and the risks associated with it.

There are various reasons it is important to identify risks and hazards inside kitchen and home and business properties. They include the following reasons:

1. It is important to identify hazards in the kitchen, home, and business properties because they may cause injury.

2. Identifying hazards will make us know how to eliminate the hazards

3. When we identify hazards we can easily prevent its future occurrence

4. Identifying hazards in the kitchen such as a bad electric cooker can prevent potential electrical shock

5. When a hazard such as leaking gas is identified, we prevent potential fire outbreak

6. Identifying hazard early is a preventive measure and it is cheaper.

7. Failure to identify hazards in business properties will lead to a great loss of profits.

8. To identify the risk of hazards is the best way to eliminate the hazards.

9. Identifying the risk of hazards can make us anticipate and quickly remove the hazards effectively.

10. It is cheaper to eliminate the risk of hazards when identified than performing repairs after hazards have caused damages.

11. Understanding and identifying the risk of hazard can help save lives, whether kitchen, home, or in business properties.

12. Identifying the risk of hazards, can lead us to have a solution in place against the hazard.

Read the following scenario. How might Sarah correct successfully complete her task?
To permanently remove a file from her computer, Sarah doubled-clicked on the My Computer icon and searched for her
file under the “Uninstall or change a program" menu option. A

Answers

Answer:

Explanation:

A: To permanently remove a file from her computer, Sarah doubled-clicked on the My Computer icon and searched for her file under the “Uninstall or change a program” menu option.

or

b: empty the recycle bin : You can permanently delete a program file installed in the computer by following the procedure in option A. The option above will take you to the control panel and you'll be able to select the program you'd want to permanently remove. If you had initially deleted a file like a picture or a document or anything else that you necessarily do not need, it will go to recycle bin. You can head over there and select the Empty the Recycle Bin option to permanently delete the file.

What is output? Select all that apply.
C=0.
while (c < 5):
c = c + 1
print(c)

Answers

Answer:

Since we didn't print it at the beginning, we can assume that the program will start printing to the console at the number: 1. After that, it continues right before hitting 5. Proving the output of the program will be the following:

1

2

3

4

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?

Most portable devices, and some computer monitors have a special steel bracket security slot built into the case, which can be used in conjunction with a:

Answers

Answer:

Instead of using a key or entering a code to open a door, a user can use an object, such as an ID badge, to identify themselves in order to gain access to a secure area. What term describes this type of object?

Explanation:

what is multimedia computer system​

Answers

A Multimedia can be defined as any application that combines text with graphics, animation, audio, video, and/or virtual reality. Multimedia systems are used for security to keep intruders out of a system and for the protection of stored documents

state the functions of all the parts of the computer​

Answers

Answer:

Parts of a computer with their functions

The computer case. This is the part that holds all of the internal components to make up the computer itself. ...

Motherboard. ...

CPU: Central Processing Unit. ...

RAM: Random Access Memory. ...

Graphics Card. ...

Sound Card. ...

Hard Drive. ...

SSD: Solid State Drive.

Explanation:

What is a frame injection attack in a wireless network?

A. A hacker inserts a forged frame during data transmission.

B. A hacker creates a botnet to flood a particular website.

C. A hacker sniffs data packets from a data transmission.

D. A hacker deletes frames during a data transmission.

The answer is A.

Answers

Answer:

A.Un hacker introduce un cadru fals în timpul transmiterii datelor.

Explanation:

A - a hacker inserts a forged frame during data transmissions

Which graph or chart shows changes in the value of data?

a
Bar graph

b
Column chart

c
Line graph

d
Pie chart

Answers

Answer:

Bar graph and Pie chart

Answer:

C And D

Explanation:

edge2020 users

How can internet affect business area? 


Answers

The communication between customers and businesses increases customer satisfaction and businesses are able to connect to the customers. it lets businesses go further to expand their service or product which can increases profit.

write a program which calculates the difference between two integers which are entered by the user. The answer should be a positive integer regardless of the order in which the integers are entered. ​

Answers

In python 3.8:

print(abs(int(input("Enter a number: "))-int(input("Enter a number: "))))

Four students measured the mass of a piece of metal whose accurate mass is 34.75g. Their results are 34.2g, 33.75g, 35.0g, and 34.69g. Explain whether the results are precise or accurate​

Answers

Answer:

The given data are more precise than they are accurate

Explanation:

From the given measurements, we have;

The accurate mass = 34.75 g

The deviations from the accurate measurement is as follows;

34.2 g - 34.75 g = -0.55 g

33.75 g - 34.75 g = -1 g

35.0 g - 34.75 g = 0.25 g

34.69 g - 34.75 g = -0.06 g

For precision measurement, we find the average deviations as follows;

The sum of the deviations = -0.55 g - 1 g + 0.25 g - 0.06 g = -1.36 g

The average deviation = -1.36 g/4 = -0.34 g

For accuracy measurement, we find the average of the absolute deviations as follows;

The sum of the absolute deviations = 0.55 g + 1 g + 0.25 g + 0.06 g = 1.86 grams

The average absolute deviation = 1.86 g/4 = 0.465 g

Therefore, the magnitude of the average deviation is less than the magnitude of the absolute deviations, therefore, the given data are more precise than they are accurate

Other Questions
Which expression is equivalent to 5p2+ 3p2 - 6p?a. 2p2b. 14p2C. 8p2 - 6pd. p(5p + 3p - 6) Appendages in arthropods are most similar to ______ in humansa: bonesb: armsc: chestsd: mouths Select the correct answer from each drop-down menu.The United States is located in the Ring of Fire. The Pacific plate makes this region prone to disasters such as earthquakes and ___. To prevent such disasters from causing damage, the US government is developing an early warning system knownas the ___. This system informs citizens about imminent earthquakes by sending them pop-up messages on their computers.Other countries located in the Ring of Fire include Chile, Canada, and ___. Based on the content of Twelfth Song of Thunder, what is important to the Navajo people?respect for naturelove of all peopleappreciation of lifecaring for the sick What is the slope of a horizontal line? PLZZZZZZZZZZ HELP MEEEEEEEE IM BEING TIMED PLZZZZ EXPLAIN THE ANSWER ALSO PLZZZZZZZZTerrance uses the jugs of water to fill cups with approximately 3.75 ounces of water each. About how many cups can Terrance fill if he uses all of the water in the jugs? Show your work or explain how you determined your answer.1 gallon = 128 fluid ouncesEnter your answer and your work or explanation in the box provided. Read the following excerpt and identify the tone you would read it with.Each time we stopped at the tops of the hills to let the dogs catch their breath after pulling the heavy sled and stove up the steep incline, Storm turned and growled at the stove. The enemy. whats 9 + 10? if you get it right brainliest What expression is equivalent to 1/2 (6x 10)? pleasee help find the equation Which of the following events happened in the late 1780s? A. The US ratified its constitution. B The US declared its independence C. The US engaged in the Civil War. D. The US obtained the Louisiana Purchase. Please select the best answer from the choices provided A OB All of the following are examples of Ilmiting factors in an ecosystem except:A.) WaterB.) FoodC.) Population densityD.) Space You now find new cells which contains 200 mM CaCl2 and 15 mM glucose. The cell membrane is permeable to Ca ions, impermeable to Cl- ions, impermeable to Na ions and impermeable to glucose. You transfer these cells into a solution which has 140 mM (NaCl) and 150 mM glucose. What happens to the cells after the solution and cell have come to equilibrium 2.Do you have a blog or web page ? Do you ever read other peoples pages? ) prove that the acceleration due to graviis independent to the mass of the falling body (02.01)Solve for x2/3(x - 2) = 4x (1 point)Select one2.a5522.5d. 5 Joy invests $13,000 into an account at an annual rate of 0.6% simple interest for 24 months. what is the principal? the green shape is a dilation of the black shape.what is the scale factor of the dilation? Find factors of polynomialA) 244 + 183 B) 4 + x C) 82 56 + 7 49plz answer properlyI will mark the person brainliest who answers properly Read the sentence and choose the option with the correct amount in the sentence.El inmueble cuesta setecientos mil quinientos veinte dlares. 600.330 600.520 700.520 700.330