the gotham\' s population function is p(t)=52.966+2.184t where t is years after
ID: 441405 • Letter: T
Question
the gotham' s population function is p(t)=52.966+2.184t where t is years after 1990 , and p is population in thousands . thus p(0) represents the population in 1990, which was 52.966 thousand people. write a program that defines a function named population that predicts gotham's population in the year provided as an input argument write a program that calls the function and interacts with the user as follows: enter a year after 1990>2015 predicted gotham city population for 2010 (in thousands) :107.566 please i need your help , i need to run this program in visual sutdio thank you so muchExplanation / Answer
#include<iostream>
#include<cstdlib>
#include<iomanip>
using namespace std;
double populationEstimate(int year);
int main(){
int Year;
double pop;
cout<<setiosflags(ios::fixed)<<setprecision(3);
cout<<"Enter a year after 1990> ";
cin>>Year;
pop=populationEstimate(Year);
if(pop==-1){
cout<<"The year you entered was before 1990. Go look at the census for "<<Year<<"'s population ";
}
else
cout<<"Predicted Gotham City population for "<<Year<<" (in thousands): "<<pop;
system("pause");
return 0;
}
double populationEstimate(int year){
double num=year-1990;
if(num<0.0){
return -1;
}
else
return(52.966 + (2.184*num));
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.