(TCO 5) Write a function that takes inputs of a number of quarters, dimes, and n
ID: 1797328 • Letter: #
Question
(TCO 5) Write a function that takes inputs of a number of quarters, dimes, and nickels (whole numbers), then calculates and returns an output of the value of the total amount of money in dollars (a floating-point value). Use appropriate parameter passing and return mechanisms. Use appropriate datatypes. For example, with inputs of 4 quarters, 3 dimes, and 3 nickels, the result would be 1.45 dollars. Use proper code formatting techniques. Do not write a main routine. Your function does not do cin or cout. (Points : 15)Explanation / Answer
float money(int quater, int dimes, int nickels) { float m = 0; m = m+ (nickles*5/100); m = m+ (dimes*10/100); m = m+ (quter*25/100); return m; }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.