Write a program that calculates how much money you are spending on average per d
ID: 3645674 • Letter: W
Question
Write a program that calculates how much money you are spending on average per day in a week. The program will calculate the total average, as well as the average of what you spend in the following categories: food, clothing, school-related expenses, and outside entertainment.You will ask the user how much he/she spends in each category for each day and keep a running total for each category. Use static variables to keep track of these amounts, as you will revisit a function containing the loop structure(s) for each day. You will also need an average function that calculates all of the averages. Organize the main program to call input and output functions. The input function will be responsible for updating the totals, and the output function will calculate and display the results. Note that these functions will most likely call other functions to accomplish tasks. Use value and reference parameters as necessary.
Explanation / Answer
sumF,sumC,sumS,sumE are the functions for updating the totals,avg is the function to calculate the average of individual as well as per day total expenses. #include int main() { static float sumF,sumC,sumS,sumE,sum,i=0; int f,c,s,e; coutf; sumF=sumF(sumF,f); coutc; sumC=sumC(sumC,c); couts; sumS=sumS(sumS,s); coute; sumE=sumE(sumE,e); sum=sum(sum,f,c,s,e); i++; if(i==7) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.