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
Gwar [14]
3 years ago
13

in java Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, o

ne coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes
Computers and Technology
1 answer:
Keith_Richards [23]3 years ago
3 0

Answer:

// Program is written in Java

// Comments are used for explanatory purposes

// Program starts here..

import java.util.*;

public class Money

{

public static void main(String [] args)

{

 Scanner input = new Scanner(System.in);

 // Declare Variables

 int amount, dollar, quarter, dime, nickel, penny;

 // Prompt user for input

 System.out.print("Amount: ");

 amount = input.nextInt();

 // Check if input is less than 1

 if(amount<=0)

  {

   System.out.print("No Change");

  }

 else

  {

   // Convert amount to various coins

   dollar = amount/100;

   amount = amount%100;

   quarter = amount/25;

   amount = amount%25;

   dime = amount/10;

   amount = amount%10;

   nickel = amount/5;

   penny = amount%5;

   // Print results

   if(dollar>=1)

    {

     if(dollar == 1) { System.out.print(dollar+" dollar\n");}

   else { System.out.print(dollar+" dollars\n"); }

}

if(quarter>=1)

{

if(quarter== 1)

{System.out.print(quarter+" quarter\n");}

else{System.out.print(quarter+" quarters\n");}

}

if(dime>=1)

{

if(dime == 1){System.out.print(dime+" dime\n");}

else{System.out.print(dime+" dimes\n");}

}

if(nickel>=1)

{

if(nickel == 1){System.out.print(nickel+" nickel\n");}

else{System.out.print(nickel+" nickels\n");}

}

if(penny>=1)

{

if(penny == 1) {System.out.print(penny+" penny\n");}

else { System.out.print(penny+" pennies\n"); }

}

}

}

}

See attachment for program file

Download java
You might be interested in
Need the answer ASAP!!! I’ll mark brainliest if correct
san4es73 [151]

Answer:

update standerds

Explanation:

7 0
3 years ago
What is desktop computer? <br> ​
butalik [34]

Answer:

a computer suitable for use at an ordinary desk.

noun: desktop computer

"a new low-end desktop"

Explanation:

please mark me as a brainly

3 0
2 years ago
Read 3 more answers
What the benefit is of folders when working with files
Aleksandr [31]
There are many benefits to using folders when working with lots of files.  Here are a few examples:

- You can use folders to sort your files by type, almost like drawers in a desk, so you might have folders for Music, Photographs, Documents, etc.

- You can use folders to group files together into a specific group.  For example in your Photographs folder you might have a folder titled BirthdayPhotographs for all the photographs from your birthday.

- As in the example above you can nest folders to create sub-categories.  Documents might include folders for Homework, Stories, Poems

- Folders can have different permissions applied to them, allowing you to keep personal files in a private folder only you can access, or secret files in a folder that doesn't show up in the normal list of folders!
4 0
3 years ago
Read 2 more answers
Which of these is NOT an advantage of the impact of computer careers.
nikdorinn [45]
I believe the answer could be the first choice. I'm not quite sure, though
4 0
3 years ago
Read 2 more answers
VLSI is the process of creating an integrated circuit (IC) by combing thousands of transistors into a single chip. There are two
malfutka [58]

Answer:

An FPGA is a field programmable gate array. It could be "programmed" to do certain task, but don't mistake it with a microprocessor. When programming an FPGA, you're actually changing it's physical structure, the logic gates inside the FPGA, to do the task for you. Therefore, unlike a microprocessor which has to run through a series of command, an FPGA could be rewired to run at a much faster and more efficient rate.

FPGA is good for testbenching and are budget friendly since they can be reprogrammed over and over again in case you messed up. However, they can be quite big and bulky, so they are not suitable for mass production.

ASIC in the other hand can be compact to a small size. ASIC are pretty much the IC chips that you use, like your Intel CPU or LM7000 series chips. However, the process of making them that small is irreversible, so if you messed up, you gotta throw away the whole batch. This make them expensive to make, but their small size and production process allows them to be made in bulk.

Both FPGA and ASIC are good for power consumption and speed because you're actually designing their physical circuit layout, so if your design is efficient then the product will be efficient in both speed and power as well.

In Summary, you design and test your circuit using an FPGA first. Then you send that design to a production company and they will use that design to mass produce it as a small chip.

7 0
3 years ago
Other questions:
  • Jerry suspects that information about his internet usage was sent to external websites without his knowledge. He is wary about t
    7·1 answer
  • What does the word tolerance mean in textiles?
    9·1 answer
  • Match the steps with the actions that are involved when an internal host with IP address 192.168.10.10 attempts to send a packet
    11·1 answer
  • The OSI model is currently the most widely implemented network model used to develop and build networks of any size, including t
    8·1 answer
  • For which type of long-distance call do you need to tell the operator the name of the person to whom you wish to speak?
    10·1 answer
  • write a c++ program that takes a string input from the user and removes all characters except numerals also display the number o
    11·1 answer
  • A computer (mainframe, server, or workstation) that has an operating system enabling _____________ to access it at the same time
    11·1 answer
  • PLEASEEEEEE HELP, ILL DO ANYTHING JUST ANSWER THESE CORRECTLY!!!!!TYSM!!!
    15·2 answers
  • Juhfvehrfwhedfhwkefhkujhiuyuiyuiyiyh
    6·1 answer
  • What are some of the characteristics found in an editorial photograph?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!