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
Prime numbers can be generated by an algorithm known as the Sieve of Eratosthenes. The algorithm for this procedure is presented
Sidana [21]

Answer:

const MAXNR=150;

let candidates = {};

for(let i=2; i<=MAXNR; i++) {

   candidates[i] = true;

}

for(let p=2; p <= MAXNR; p++) {

   if (candidates[p]) {

       process.stdout.write(`${p} `);

       // Now flag all multiples of p as false

       i=2;

       while(p*i <= MAXNR) {

           candidates[p*i] = false;

           i++;

       }

   }

}

4 0
3 years ago
Which of these devices can completely stop broadcasts from being passed on across the network? routerswitchaccess ponthub
cestrela7 [59]

Answer

An Access point can completely stop broadcasts from being passed on across the network.

Explanation.

An Access point is a hardware type that is part of local area network which has capability of allowing wireless communication from devices through a wireless stand,which connects in between devices and the network. A good example of these devices are routers that allows wireless devices to connect to a wireless network.So when it is passed on across a network an Access point can completely stop.

8 0
3 years ago
Read 2 more answers
I need like 10 sentences to delineate and discuss societal issues related to computing . “Including the guiding principles of pr
beks73 [17]

Answer:

Kindly check Explanation

Explanation:

Advancement in technology spurred largely due to the advent of the computer and internet has resulted in a notable change in the behavior, lifestyle and engagement of many individuals. This include ; providing a faster and more convenient way of computing and completing tasks. Accelerating the global rate of technological development due to great computing capabilities. Educational enhancement and development through online education.

Computing also pose some societal issues which needs to addressed. This include :

Issues regarding privacy and identity theft are widespread. Addiction to games and other engaging content often pose distraction to youth and child development. Computing could be said to have placed increased pressure on human power and engagement with the advent of automated robots and programs. Increased exposure to electromagnetic rays. Promotion of indecency and immoral contents has become increasingly easier. Peer influence through fake promotion and display of wealth by some overrated individuals.

Therefore, it is imperative that informations conveyed through the internet are treated with utmost confidentiality in other to avoid privacy issues which may arise from leakage.

8 0
4 years ago
Windows service accounts will use passwords consisting of at least 15 characters.
vichka [17]
False because u need 16 letters
4 0
4 years ago
What’s unique about windows 8 compared to earlier windows
skad [1K]
New Interface, features like start screen, faster boot time, dynamic desktop, improved search function, windows love syncing, windows to go, and improved security.
7 0
3 years ago
Other questions:
  • A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-lif
    11·1 answer
  • What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float? a double??
    8·1 answer
  • With respect to the five components of social media information systems (SMIS), which of the following statements is true of SM
    11·1 answer
  • Presses the Schedulr app icon Selects the list item for CSCI 448 Presses the "View Classroom on Map" button While only performin
    11·1 answer
  • Your computer sign-in screen is visible, but after you enter your sign-in credentials the computer fails to sign in and present
    6·1 answer
  • What happens when you get 3 warnings on this site?
    9·2 answers
  • Was LDAP version2 an internet standard in 1998? is it now?
    5·1 answer
  • Which of the following is not an example of debugging? looking for errors in programming code. fixing misspelled commands in pro
    13·1 answer
  • How do i put pics on this app ​
    10·1 answer
  • Define a SCHEME function, unzip, which takes a list of pairs ((a .b)... (an .bn)) and returns a pair consisting of the two lists
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!