View the step-by-step solution to:

a bank teller who has to give amounts of money to customers but can't count very well so needs you program to help them. a) Write C program that will...

a bank teller who has to give amounts of money to customers but can't count very well so needs you program to help them.

 

a) Write C program that will accept an integer value in the range of 5-95 and as a multiple of 5 representing the number of cents to give to a customer in their change. The program should calculate how many coins of each denomination and display this to the user. Valid coin values are 50, 20, 10 and 5. Your solution (program and algorithm) should be modular in nature. This requires the submission of a high-level algorithm and suitable decompositions of each step.

 

- for this problem the principle of code reuse is important

-should have one function in particular that can be reused (called repeatedly) in order to solve the majority of the problem


b)write C program that will allow the user to enter the amount of change as dollars and cents as a double (real number). Valid dollar values are 100, 50, 20, 10, 5, 2 and 1. The program should output the correct combination of dollar and cent denominations required and should be able to work for any valid dollar amounts. Cents amounts may be should be multiples of 5.

 

-you will need to explicitly convert a double to an integer to break the inputted double down to its component parts as integers

-use code below as the basis

 

float change;

int dollar, cents;


...


dollar = (int) change;

cents = (int) (((change - dollar)*100) + 0.5);

Top Answer

OUTPUT: A) Enter cents: 50 Coins Fifty: 1 twenty: 0 Ten: 0... View the full answer

QUSTA.PNG

1 comment
  • thank you so much for your help..... i need the program to have functions like :int getData() : int makeChange(int &totalChange, int cent) : void printResults (int num1, int CENT) and so on to be called at main.... can you please help
    • crusty2018
    • May 15, 2018 at 9:01am

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online