Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS MY QUESTION, WRITE A CODE IN C++ 12.1 Change Calculator Write a program that calculates number of coins for a given positive cash

THIS IS MY QUESTION, WRITE A CODE IN C++

12.1 Change Calculator

Write a program that calculates number of coins for a given positive cash amount in pennies. So if you input 59, then the output would look like:

59 has 2 quarters, 0 dimes, 1 nickels, 4 pennies

A template has been provided for you

AND THIS IS MY CODE:

#include using namespace std; void computeCoins(int coin_value, int &num, int &amount_left)

{ while(amount_left >= coin_value) { num++; amount_left -= coin_value; } } int main() { int amount_left; int quarters = 0, dimes = 0, nickels = 0; while(true) { printf("Enter number of cents (or zero to quit): "); cin>>amount_left; if(amount_left 99) { cout

WHEN I SUBMIT IT INTO ZYBOOK, I GOT 0 POINT, AND I DONT KNOW WHERE IS THE PROBLEM.

PLEASE HELP ME FIX IT.

THANK YOU!!

image text in transcribed

Only show failing tests Download this submission 1: Compare outputA 0/5 Program generated too much output. Output rostricted to 50000 characters. Check program for any unterminated loops generating output. Input 59 Enter number of cents (or zero to quit): 59 cents can be given as 2 quar Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cent.s can be given as 4 penni Entor number of cents for zero to quit): 4 cents can be given as 4 penni ntor number of cents (or zero to quit): 4 cents can be given as 4 ponni Enter number of cents (or zero to quit): 4 cents can be given as 4 penn Enter number of cents (or zero to quit): 4 cents can be given as 4 penn Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 1 penni Enter number of cents (or zero to quit): 4 cents can be given as 1 pen nter number of cents (or zero to quit): 4 cents can be given as 1 penn Enter number of cents (or zero to quit): 4 cents can be given as 1 penn Enter number of cents (or zero to quit): 4 cents can be given as 1 penn Enter number of cents (or zero to quit): 4 cents can be given as 1 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penn Enter number of cents (or zero to quit): 4 cents can be given as 4 penni

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago

Question

8. Satyam Computer Services Limited

Answered: 1 week ago

Question

2. Explain how the role of training is changing.

Answered: 1 week ago

Question

7. General Mills

Answered: 1 week ago