1.Write a function that converts an input of some integer number of nickels into
ID: 3630831 • Letter: 1
Question
1.Write a function that converts an input of some integer number of nickels into outputs of integer numbers of dollars, quarters, and nickels. Do not write a main function. Your function does not do cin or cout. Your function will have four parameters. Make sure you use appropriate parameter passing techniques! Your function will be a void function. There are 5 nickels in a quarter, and 20 nickels in a dollar. For example, if the total number of nickels input is 27, the results are 1 dollar, 1 quarter, and 2 nickels.2.Write a function that takes inputs of quarts and pints (whole numbers), then calculates and returns an output of the total number of gallons (a floating-point value). There are 4 quarts in a gallon, and 2 pints in a quart. Use appropriate parameter passing and return mechanisms. Use appropriate datatypes. For example, with inputs of 4 quarts and 4 pints, the result would be 1.5 gallons. Use proper code formatting techniques. Do not write a main routine. Your function does not do cin or cout.
3.Write a function called AnalyzeData. This function is passed a double array along with a parameter that indicates the number of elements in the array. It is also passed a double value. The function computes and returns the number of values in the array that are greater than this double value. Write a complete C++ function to do this operation. There is no cin or cout in this function. This is only a function, so there is no main routine here!
Explanation / Answer
please rate - thanks
double toGallons(int q,int p)
{return q*.25+p*.125;
}
void change(int nickels)
{int total,dollars,quarters;
total=nickels*5;
dollars=total/100;
total%=100;
quarters=total/25;
total%=25;
nickels=total/5;
cout<<dollars<<" dollars, "<<quarters<<" quarters and "<<nickels<<" nickels ";
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.