C programming 9. An epidemic of a new strain of flu (i.e., one for which a vacci
ID: 3750322 • Letter: C
Question
C programming
9. An epidemic of a new strain of flu (i.e., one for which a vaccine is not available) begins with a single case on a college campus of 40,000 faculty, staff, and students. Three days later a second case is reported, and in the following days the reported cases are as shown in the table below. The day of the initial case report is noted as day 0 Day # 10 Total cases 4 15 A math professor observes that the number of cases seems to be increasing by about 28% per day and proposes the following model to predict the total number of cases by day number x 40000 Cases (x) 139999 (e 0.24081) Write a function that implements this model. Test your function with a main function that prompts the user three times to entera day number and then calculates and displays the number of cases predicted for each day number entered Sample run ELU EPIDEMIC PREDICTIONS BASED ON ELAPSED DAYS SINCE FIRST CASE REFORT Enter day number>> By day 7, model predicts 5 cases total. Enter day number>> 10 By day 10, model predicts 11 cases total. windows Enter day number>>20 By day 20, model predicts 138 cases total. I aExplanation / Answer
#include <stdio.h>
#include <math.h>
int model(int day){
double x = -0.24681*day;//power of exponential
double k = exp(x);//the exponent term
return 40000/(1+39999*k);//put k in the original formula
}
int main() {
for(int i=0;i<3;i++){
int day;
printf("Enter day number>> ");
scanf("%d",&day);
int ans = model(day);
printf("By day %d, model predicts %d cases total. ",day,ans);
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.