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

Your program should accept dollar amounts from the user until 0is entered. Each

ID: 3614047 • Letter: Y

Question

Your program should accept dollar amounts from the user until 0is entered. Each exact dollar amount should be rounded to thenearest $10 value. The exact and rounded amounts should then beused to keep track of:

After the user has entered an exact amount of 0, display thesum, average, and standard deviation for both the exact and roundedamounts. Calculate the percent difference between the sums of theexact and rounded amounts and make a determination as to whether ornot it's cost effective to round the dollar values.

When testing your program, keep in mind that $10 is a greaterpercent of a small value, than of a large value. If you test withonly very small numbers (like $1.35, $2.99), common sense shouldtell you that the results will be radically different.

The purpose of this function is to "get" an exact dollar amountfrom the user and verify that it is either 0 or positive. As longas the value entered is invalid, display an error message andprompt the user for a new value. This should be done until a validvalue is entered. Once a valid value is entered, it should bereturned to the calling function.

The purpose of this function is to round the passed in amount tothe nearest $10 value and return the rounded amount.

To round to the nearest $10: 1) add 5 to the exact amount, 2)divide by 10, 3) multiply the integer portion by 10.

The purpose of this function is to calculate and return anaverage if the count is greater than 0. If the count is less thanor equal to 0, return -1.

The purpose of this function is to calculate and return thestandard deviation if the count is greater than 1. If the count isless than 1, return -1. The formula for standard deviation is:

where

The purpose of this function is to calculate and return thepercent difference between the sum of the exact values and the sumof the rounded values. To calculate percent difference:

Think about using the function fabs() to find theabsolute value.

The output from your program should consist of the prompts tothe user to enter dollar amounts, a neatly formatted table thatdisplays the results from the calculations, and a messageindicating whether the percent difference is acceptable orunacceptable.

The basic format for the table is:

For average (and standard deviation), if the return code fromcalcAverage (and calcStdDev) is not -1, display both the exact androunded average (and standard deviation). If the return code is -1,display a message that the average (and standard deviation) couldnot be calculated.

Explanation / Answer

please rate - thanks #include #include #include using namespace std; double getAmount(); double roundAmount(double); double calcAverage(double,int); double calcStdDev(double, double , int ); double calcDiff(double, double); int main() {double exact,esum=0,esumsq=0,rounded,rsum=0,rsumsq=0,estd,rstd,diff; int count=0; exact=getAmount(); while(exact>0)    {rounded=roundAmount(exact);    esum+=exact;    esumsq+=(exact*exact);    rsum+=rounded;    rsumsq+=(rounded*rounded);    count++;    exact=getAmount();    } estd= calcStdDev(esum,esumsq,count); rstd= calcStdDev(rsum,rsumsq,count); diff= calcDiff(esum,rsum); cout