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
Today when Dylan turned on his computer, he noticed that the monitor was very dim. He could still see the desktop icon and text.
Vadim26 [7]

Answer:

B. Monitor backlighting

Explanation:

The computer system is a machine that can digitally receive input, process the inputted data and display and save results. The computer system is a physical system driven by a software component.

The computer hardware components are classified as input unit or devices, output unit, memory and storage unit, and  processing unit. The screen is an output unit of the computer system, it displays the output or result of the processed data.

The power supply to the screen, in this context, is not faulty due to the other screen used in testing the supply and input connectors. The back light on the screen has failed and that is why the brightness can not be adjusted.

3 0
3 years ago
Multiple choice
Bezzdna [24]
The answer is D. The colors that we see are all being reflected.
7 0
3 years ago
Read 2 more answers
Xml provides a standardized, non-customizable way to describe the content of a document.
Rainbow [258]
XML (eXtensible Markup Language) is a meta-language that defines a language (of your creation, within XML specs). The language that you create has to follow your specifications.
7 0
3 years ago
Implication of technological literacy to a teacher training today
Dafna1 [17]

<u>Implication of technological literacy to a teacher training today :</u>

  • First of training has to be under technology literacy before training starts. Trainer also should have enough knowledge on technology literacy.
  • Trainer can take printed materials to share the document on the topic which to be covered and circulated to trainers
  • Since it given as general topic, training teacher has to cover the following topic, general on computer and purpose of computer today's life, life cycle of computer grown from old PC to laptop and tablet.
  • Next topic such be covered operating system and explain about the operating system and different technology is used.
  • Revolution on technology should be also covered and explained in details.
8 0
3 years ago
Identify the selector in the following CSS code:
SashulF [63]

Answer:

The right answer is: Option A. h3

Explanation:

The purpose of using selectors in CSS is to find the elements in the HTML page to which the formatting will be applied.

Different type of selectors are used in CSS.

In the given code, h3 is the selector.

All the <h3> elements on the page will be of orange color and will have font size 12.

Hence,

The right answer is: Option A. h3

6 0
3 years ago
Other questions:
  • To calculate the chapter from which you must solve the programming exercise, divide the integer number representing your student
    10·1 answer
  • To resize columns in a subform, press and hold or right-click the subform in the navigation pane, and tap or click ____ on the s
    12·1 answer
  • What feature new to Windows Server 2012 provides the ability to find identical sets of data on a SAN based storage array and red
    14·1 answer
  • Write the WordSandwich method allSandwiches. This method creates and returns a new array of String objects as follows. Each elem
    13·1 answer
  • What in the world is this for and how do you use it
    8·2 answers
  • How does abstraction help us write programs
    11·1 answer
  • Formatting means ____________
    12·2 answers
  • Discuss five domains of Instructional technology​
    7·1 answer
  • Which of the following statements is true for DMA: (only one correct answer) A. In DMA, Processor checks status until the operat
    9·1 answer
  • FREEEEE 100 POINTS COME TAKE COME COME COME<br><br> only if u like da black panther
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!