Question 1. Write a function called AnalyzeData. This function is passed a doubl
ID: 3555441 • Letter: Q
Question
Question 1. 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!
Question 2. 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.
Question 3. Write a function that converts an input of some integer number of inches into outputs of integer numbers of yards, feet, and inches. 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 12 inches in a foot, and 36 inches in a yard. For example, if the total number of inches input is 50, the results are 1 yard, 1 foot, and 2 inches.
Explanation / Answer
1
int AnalyzeData(double array[] ,int size ,double val)
{
int num =0;
for(int i= 0;i<size;i++)
{
if(array[i] > val)
{
num++;
}
}
return num;
}
2
double convert(int quarter, int dime,int nickel)
{
return (quarter/4.0) + (dime/10.0) + (nickel/20.0);
}
3
void convert(int inch ,int & yard , int & feet , int & inches)
{
yard = inch /36 ;
inch = inch - yard * 36;
feet = inch/12;
inches = inch - feet*12;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.