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
Vikki [24]
3 years ago
13

Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per l

ine. 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 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes
Computers and Technology
1 answer:
Anna007 [38]3 years ago
4 0

Answer:.

// Program is written in C++.

// Comments are used for explanatory purposes

// Program starts here..

#include<iostream>

using namespace std;

int main()

{

// Declare Variables

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

// Prompt user for input

cout<<"Amount: ";

cin>>amount;

// Check if input is less than 1

if(amount<=0)

{

cout<<"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)

{

cout<<dollar<<" dollar\n";

}

else

{

cout<<dollar<<" dollars\n";

}

}

if(quarter>=1)

{

if(quarter== 1)

{

cout<<quarter<<" quarter\n";

}

else

{

cout<<quarter<<" quarters\n";

}

}

if(dime>=1)

{

if(dime == 1)

{

cout<<dime<<" dime\n";

}

else

{

cout<<dime<<" dimes\n";

}

}

if(nickel>=1)

{

if(nickel == 1)

{

cout<<nickel<<" nickel\n";

}

else

{

cout<<nickel<<" nickels\n";

}

}

if(penny>=1)

{

if(penny == 1)

{

cout<<penny<<" penny\n";

}

else

{

cout<<penny<<" pennies\n";

}

}

}

return 0;

}

You might be interested in
GIMP's official website is _____
Naddik [55]
Https://www.gimp.org/

4 0
4 years ago
A client calls to complain that his computer starts up, but crashes when Windows starts to load. After a brief set of questions,
melomori [17]

Answer:

It may be that the amount of ram is not compatible with that computer, it may not support ram that is over 8 GB or higher, it may not be properly installed in the hardware, or the motherboard may not be able to read it.

Explanation:

Hardware and software is very unbalanced when it comes to new RAM being installed, as people complain about this exact same issue many times.

5 0
4 years ago
1. The letters that appear after the dot after a file name are called the:
Murrr4er [49]

Answer:

Files Extension.

Explanation:

The letters that follow the period at the end of a file name are the file's extension. This enables the computer to know what application it should use to read the file.

7 0
2 years ago
Which principle of CSR requires that a business state facts fully and accurately?
DaniilM [7]

Answer: transparency

Explanation:

3 0
3 years ago
how to create use an array of Course objects instead of individual objects like course 1, course 2, etc
AURORKA [14]

Answer:

To save the course object instances in an array, use;

Course[] courses = new Course[7];

courses[0] = new Course("IT 145");

courses[1] = new Course("IT 200");

courses[2] = new Course("IT 201");

courses[3] = new Course("IT 270");

courses[4] = new Course("IT 315");

courses[5] = new Course("IT 328");

courses[6] = new Course("IT 330");

Explanation:

The java statement above assigns an array of size 7 with the course class constructor, then order courses are assigned to the respective indexes of the new array.

3 0
3 years ago
Other questions:
  • What is the purpose of the print area feature​
    11·1 answer
  • What is a series of instructions or commands that a computer follows used to create software
    9·1 answer
  • A(n) _____ might be written by a programmer or it might be created through a DBMS utility program.
    6·1 answer
  • A pair is a simple struct with two data members, one of type T1 and one of type T2. A set and a map are organized as binary sear
    10·1 answer
  • When Russ opened a website on his browser, he saw an error that the site was not compatible with the browser version he was runn
    9·1 answer
  • Ronald downloads a movie from the Internet onto his company's computer. During this process, his system gets infected with a vir
    12·1 answer
  • What methods would you add to make this class declarationvery useful?
    11·2 answers
  • When you navigate inside a compressed folder, you click the
    6·1 answer
  • 1. It is a set of integrated devices that input, output,
    11·1 answer
  • When proposing a plan in detail for video production phases, fundraising, and outreaching, which section will you use to make su
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!