Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ write a program which: -Prompts the user to enter a positive integer, think of this integer as representing a specific number of pennies.

In C++ write a program which:
-Prompts the user to enter a positive integer, think of this integer as representing a specific number of pennies.
-The program should calculate and display the least possible number of coins (quarters, dimes, nickels and cents) that may be used to represent the number of pennies entered by the user. For Example: If the user enters 28, then the program should display 1 quarter and 3 pennies. See other examples below.
-The program MUST display the results using proper grammar (singular or plural).
-The program MUST validate the user input and NOT allow ANYTHING that is not an integer greater than or equal to zero.
-The user must be allowed to continue entering numbers unless (s)he chooses to quit.
image text in transcribed
The program's display must adhere to the following rules: 1. One "coin" per line. 2. Proper use of the singular or plural nouns; example 1 dime or 2 dimes 3. Only display coins that are actually used in the result Acceptable examples include: 1 quarter2 dimes 3 pennies 2 quarters 1 dime 1 penny 1 nickel 4 pennies Unacceptable examples of change include: 1 quarter 0 dimes 0 nickels 3 pennies 2 quarter(s) 1 dime(s) 1 nickel 1 penny The program's display must adhere to the following rules: 1. One "coin" per line. 2. Proper use of the singular or plural nouns; example 1 dime or 2 dimes 3. Only display coins that are actually used in the result Acceptable examples include: 1 quarter2 dimes 3 pennies 2 quarters 1 dime 1 penny 1 nickel 4 pennies Unacceptable examples of change include: 1 quarter 0 dimes 0 nickels 3 pennies 2 quarter(s) 1 dime(s) 1 nickel 1 penny

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

Students also viewed these Databases questions