Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would i replace the void output with: void print_coins(int quarters , int di

ID: 3631222 • Letter: H

Question

How would i replace the void output with:
void print_coins(int quarters , int dimes, int nickles, int pennies);

in this:

// Include Section
#include <iostream>
using namespace std;

void compute_coin(int coin_value, int& number, int& amount_left);
// Determines the types of coins to be returned

void input(int& amount_left);
// Used to get the input from user

void output(int& number, int& amount_left);
// Used for output of change



int main()
{
int coin_value;
int amount_left;
int number;



input(amount_left);
//compute_coin(number, amount_left); get rid of theentire instruction--it's not needed
output(number, amount_left);



return 0;
}
void compute_coin(int coin_value, int& number, int& amount_left)
{
number = amount_left/coin_value; //Calculates how many coins
amount_left = amount_left%coin_value; //Gets value of money left
return;
}
void input(int& amount_left)
{
cout << "Enter the amount ofchange. ";
cin>> amount_left;
}
void output(int& number, int& amount_left)
{
compute_coin(25, number, amount_left); //Number of Quarters
cout<< number<<"quarters"<<endl;

compute_coin(10, number, amount_left); //Number of Dimes
cout<< number<<"dimes"<<endl;

cout<< amount_left<<"pennies"<<endl; // Number of Pennies
}

Explanation / Answer

please rate - thanks

// Include Section
#include <iostream>
using namespace std;
void print_coins(int quarters , int dimes, int nickles, int pennies);
void compute_coin(int coin_value, int& number, int& amount_left);
// Determines the types of coins to be returned

void input(int& amount_left);
// Used to get the input from user

// Used for output of change



int main()
{
int coin_value;
int amount_left;
int number;
int quarters,dimes,nickles,pennies;


input(amount_left);
compute_coin(25,quarters, amount_left); //Number of Quarters
compute_coin(10,dimes, amount_left); //Number of Dimes
compute_coin(5,nickles, amount_left); //Number of nickles & pennies
pennies=amount_left;
print_coins(quarters , dimes, nickles, pennies);
system("pause");
return 0;
}
void compute_coin(int coin_value, int& number, int& amount_left)
{
number = amount_left/coin_value; //Calculates how many coins
amount_left = amount_left%coin_value; //Gets value of money left
return;
}
void input(int& amount_left)
{
cout << "Enter the amount ofchange. ";
cin>> amount_left;
}
void print_coins(int quarters , int dimes, int nickles, int pennies)
{cout<< quarters<<" quarters"<<endl;
cout<< dimes<<" dimes"<<endl;
cout<< nickles<<" nickles"<<endl;
cout<< pennies<<" pennies"<<endl; // Number of Pennies
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote