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

Assume that United States consumers put $51 billion in fast food charges on thei

ID: 3651098 • Letter: A

Question

Assume that United States consumers put $51 billion in fast food charges on their credit and debit cards in 2006, up from $33.2 billion in 2005. Based on this model of the billions of fast food charges
F(t) = 33.2 + 16.8t
where t is years since 2005, write a program that repeatedly prompts the user to enter a year after 2005 and then predicts the billions of dollars of fast food charges U.S. consumers will make in that year. Define and call a function fast_food_billions that takes the year as its input argument and returns the prediction as its result. Tell the user that entry of a year before 2005 will cause the program to stop.

Explanation / Answer

Please rate...

Program:

#include<stdio.h>
double fast_food_billions(int);
void main()
{
    int a,i,y;
    while(1)
    {
        printf(" Enter a year after 2005[enter a year before 2005 to stop]: ");
        scanf("%d",&y);
        if(y<=2005)break;
        double t=fast_food_billions(y);
        printf("Calculated fast-food charges= $%0.2f billion",t);
    }
}
double fast_food_billions(int y)
    {
        double t=33.2 + (16.8*(y-2005));
        return t;
    }

=============================================

Sample output:

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