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

1.Write a function that takes inputs of quarts and pints (whole numbers), then c

ID: 3639113 • Letter: 1

Question

1.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.


2. 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.

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 ";
}

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