a. Write a function named totamt() that uses four parameters named quarters, dim
ID: 3646317 • Letter: A
Question
a. Write a function named totamt() that uses four parameters named quarters,dimes, nickels, and pennies, which represent the number of each of these coins in a piggybank.
The function should determine the dollar value of the number of quarters, dimes,
nickels, and pennies passed to it and return the calculated value.
b. Include the function written in Exercise 7a in a working program. Make sure your function
is called from main() and returns a value to main() correctly. Have main() use a cout
statement to display the returned value. Test the function by passing various data to it and
verifying the returned value.
Explanation / Answer
#include using namespace std; void input(&quarters, &dimes, &nickels, &pennies){ cout > quarters; cout > dimes; cout > nickels; cout > pennies; } int totamt (int quarters, int dimes, int nickels, int pennies) { return (quarters*25)+(dimes*10)+(nickels*5)+pen… } void display(int totalamount){ float temp; temp =totalamount/100; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.