Task 4: a) Write a function named change() that has an integer parameter and six integer reference parameters named hundreds, fifties, twenties, tens, fives, and ones. The function is to consider the passed integer value as a dollar amount and convert the value into the fewest number of equivalent bills. Using the reference parameters, the function should alter the arguments in the calling function. b) Include the function written in part a in a working program. Make sure your function is called from main() and returns a value to main() correctly. Have main() use a printf statement to display the returned value. Test the function by passing various data to it and verifying the returned value.
C/C+ program language
CODE:
#include <iostream>
using namespace std;
//method to return the change
void change(int amount,int *hundreds,int *fifties,int
*twenties,int* tens,int *fives,int *ones){
//initializing the variables
*hundreds = 0; *fifties = 0; *twenties = 0; *tens = 0;*fives =
0;*ones = 0;
//if amount is greater than hundred then hundreds note can be
used
if(amount >= 100){
*hundreds = amount/100;
//amount is revised
amount = amount%100;
}
if(amount >= 50){
//if the remaining amount is greater than 49 fifties can be
used
*fifties = amount/50;
amount = amount%50;
}
if(amount >= 20){
//if the remaining amount is greater than 19 twenties can be
used
*twenties = amount/20;
amount = amount%20;
}
if(amount >= 10){
//if the remaining amount is greater than 9 tens can be used
*tens = amount/10;
amount = amount%10;
}
if(amount >= 5){
//if the remaining amount is greater than 4 fives can be used
*fives = amount/5;
amount = amount%5;
}
if(amount >= 1){
//if the remaining amount is greater than 0 ones can be used
*ones = amount;
}
}
int main() {
//main method
int hundreds,fifties,twenties,tens,fives,ones;
int amount = 467;
//calling the function
change(amount,&hundreds,&fifties,&twenties,&tens,&fives,&ones);
cout<<"\nAmount: $"<<amount<<endl;
cout<<"Hundreds: "<<hundreds<<endl;
cout<<"Fifties: "<<fifties<<endl;
cout<<"Twenties: "<<twenties<<endl;
cout<<"Tens: "<<tens<<endl;
cout<<"Fives: "<<fives<<endl;
cout<<"Ones: "<<ones<<endl;
amount = 57;
//calling the function
change(amount,&hundreds,&fifties,&twenties,&tens,&fives,&ones);
cout<<"\nAmount: $"<<amount<<endl;
cout<<"Hundreds: "<<hundreds<<endl;
cout<<"Fifties: "<<fifties<<endl;
cout<<"Twenties: "<<twenties<<endl;
cout<<"Tens: "<<tens<<endl;
cout<<"Fives: "<<fives<<endl;
cout<<"Ones: "<<ones<<endl;
amount = 1037;
//calling the function
change(amount,&hundreds,&fifties,&twenties,&tens,&fives,&ones);
cout<<"\nAmount: $"<<amount<<endl;
cout<<"Hundreds: "<<hundreds<<endl;
cout<<"Fifties: "<<fifties<<endl;
cout<<"Twenties: "<<twenties<<endl;
cout<<"Tens: "<<tens<<endl;
cout<<"Fives: "<<fives<<endl;
cout<<"Ones: "<<ones<<endl;
return 0;
}
_______________________________________
CODE IMAGES:



_________________________________________________
OUTPUT:

___________________________________________
Feel free to ask any questions in the comments section
Thank You!
Task 4: a) Write a function named change() that has an integer parameter and six integer...
design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. for example if 7 and 12 are passed as arguments to the function the function should return 12. use the function in a program that prompts the user to enter two integer values. the program should display the value that is the greater of the two.
Write a console application that has/does the following • A method that uses a ref parameter for an integer. o Change the value of the ref parameter inside the method. • A method that has optional parameters. • A method that uses named arguments. • A Main method that has an integer variable with a value assigned to it. o Call the method that implements the ref parameter. o Print the value of the variable both before and after calling...
Write a C function named date() that receives an integer number of the long date, date form is yyyymmdd, such as 20070412; and the addresses of three variables named month, day, and year. determines the corresponding month, day, and year; and returns these three values to the calling function. For example, if date() is called using the statement longdate=20200411; date(longdate, &month, &day, &year); the number 4 should be returned in month, the number 11 in day, and the number...
Write a program that contains the function measure() that is to accept a long integer number total and the addresses of the integer variables inches, feet, yards, and miles. The passed long integer represents the total number of inches, and the function is to determine the number of miles, yards, feet, and inches in the passed value, writing these values directly into the respective variables declared in the calling function. This function will be called from the main program and...
I am supposed to a pseudocode function named max that accepts two integer values as arguments and returns the value that is greater of the two. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is greater of the two. Is everything correct and complete? //Pseudocode //This function takes two integers as parameters: x and y Begin : Max(x,y) If(x>y) then MAX=x Else MAX=y End if Return...
Write a function named squareIt() that computes the square of the value passed to it and displays the result. The function should be capable of squaring numbers with decimal points. b. Include the function written in Exercise 4a in a working program. Make sure your function is called from main(). Test the function by passing various data to it. in C code please
Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...
Functionality to build (4 functions) read_csv_header Define a function named read_csv_header with one parameter. This parameter will be a csv reader object (e.g., the value returned when calling the function csv.reader). The first row read using the parameter is the file's header row. The header row contains the keys for the data stored in the CSV file. This function must return a list containing the strings from that header row. The function parameter will be a csv reader object and...
Positive and negative: Return these four results using C++ reference parameter Write a function, named sums(), that has two input parameters; an array of floats; and an integer, n, which is the number of values stored in the array. Compute the sum of the positive values in the array and the sum of the negative values. Also count the number of positives and negative numbers in each category. Write a main program that reads no more than 10 real numbers...
Write a function named numPerfect that takes as parameters: an array of integer scores between zero and 100 (inclusive) the size of the array and returns the number of perfect scores in the array. Also write a main function that creates and initializes an array of ints (in the appropriate range), calls the function with that array, and prints out the return value.