Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C program You have to write a complete C program that compiles and runs in Codeblocks, but the function is the most important part to

image text in transcribed

C program

You have to write a complete "C" program that compiles and runs in Codeblocks, but the function is the most important part to be evaluated in this question. The function must: - Receive the following parameters: price of the item including cents, and amount used as payment. - Calculate the number of Dollars, Quarters, Dimes, Nickels, and Pennies, to complete the change amount. - Print the number of each coins value needed to complete the change. The main must: - Prompt the user for the exact price of the item Prompt the user for the sum of the bills that will be used for payment - Call the function passing the two values as paramenters. Prompt the user AGAIN for the exact price of a NEW item (double). If the user answers with a negative number (-1) then the program ends. Otherwise you must prompt the user for the sum of the bills that will be used for payment of the NEW item (int) The main keeps calling the function until the user answer to the exact price is a negative number Hints: In the function .. 1. Calculate the total number of cents needed for the change. (payment - price Tag) 2. For each type of coin starting with the biggest value calculate the number of coins needed for the change: for instance (numQuarters = numCents / 25) gives you the number of quarters. 3. After each number of coins calculation is completed, calculate the amount of change left, this is the remainder (changeLeft = numCents % 25) The following is an example of how your program should look when you execute it

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_2

Step: 3

blur-text-image_3

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

Students also viewed these Databases questions