Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the source code exactly as instructed here.. And the output should be same as the example. Coin Name Value ($) Value (cents) Toonie

image text in transcribed

image text in transcribed

image text in transcribed

I need the source code exactly as instructed here.. And the output should be same as the example.

Coin Name Value ($) Value (cents) Toonie $2.00 200 cents Loonie $1.00 100 cents Quarter $0.25 25 cents Dime $0.10 10 cents Nickel $0.05 5 cents Penny $0.01 1 cent 4. Start the program by displaying to standard output (screen) the underlined title (2 lines). 5. Display the following message to the user: Enter dollars and cents amount to convert to coins: $ 6. Assume the user enters the value 9.92, this is what the screen should look like: Note: represents hitting the enter key - this is not displayed Enter dollars and cents amount to convert to coins: $9.92 1. Review the "Part-2 Output Example" (next section) to see how this program is expected to work 2. You will need to display the service fee which is calculated as 5% of the entered value. 3. You will need to deduct the service fee from the entered value to determine the total amount to be dispensed in coins. Problem: 9.92 * 0.05 = 0.496, which should be rounded up to 0.50. The printf format specifier "%.20f" will apply rounding when displaying this value, BUT don't be fooled, the actual variable value will NOT be rounded. 4. You will need to apply appropriate rounding so when you multiply by 100 (to work in total cents) and cast to an int type, which we must do at some point in the program (see below), the value will properly represent the desired rounded value for any entered initial amount. 5. Part-2 of this workshop requires you to use the modulus (%) operator (failure to use the modulus operator in all required cases will result in a zero grade). O You will need to work in total cents and use integer division with the modulus operator as required to properly calculate each coin denomination and respective remaining balance at each interval. All necessary calculations after determining the balance to be dispensed (less the service fee) must use integer division and the modulus operator (do NOT use a float or double type variable from this point onward in your program -use casting when needed) To display a floating point number based on an integer type variable holding 5 (representing 5 cents) as $0.05, you can do the following: printf("$%1.21f", (double) intBalance/100) Part-2 Output Example (Note: Use this data for submission) Change Maker Machine ======= ====== Enter dollars and cents amount to convert to coins: $9.92 Service fee (5.0 percent): 0.50 Balance to dispense: $9.42 $2.00 Toonies X 4 (remaining: $1.42) $1.00 Loonies X 1 (remaining: $0.42) $0.25 Quarters X 1 (remaining: $0.17) $0.10 Dimes X 1 (remaining: $0.07) $0.05 Nickels X 1 (remaining: $0.02) $0.01 Pennies X 2 (remaining: $0.00) All coins dispensed

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions