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

14. Write a program that calculates the speed of sound (a) in air of a given tem

ID: 3639317 • Letter: 1

Question

14. Write a program that calculates the speed of sound (a) in air of a given temperature T (OF). Formula to compute the speed in ft! see: 4 = 1086 root 5T +297/247 Be sure your program does not lose the fractional part of the quotient in the formula shown. As part of your solution, write and call a function that displays instructions to the program user. 15. After studying the population growth of Gotham City in the last decade of the twentieth century, we have modeled Gotham's population function as P(t) = 52.966 + 2.184t where t is years after 1990, and P is population in thousands. Thus, P(O) represents the population in 1990, which was 52.966 thousand people. Write a program that defines a function named population that pre- dicts 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

Explanation / Answer

#include <iostream>
#include <cmath>
using namespace std;

void displayInfo()
{

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
double temp = 70.0;
double numerator = 5.0*temp + 297.0;
double speed = 1086.0*sqrt(numerator/247.0);

cout << "Speed of sound at " << temp << " degrees: " << speed << endl;

return 0;
}


    cout << "*** Speed of sound calculator ***" << endl;
    cout << "Enter the temperature and the speed of sound will be calculated." << endl;
}
int main()
{
    double temp = 70.0;
    double numerator = 5.0*temp + 297.0;
    double speed = 1086.0*sqrt(numerator/247.0);

    displayInfo();
    cout << "Speed of sound at " << temp << " degrees: " << speed << endl;

    return 0;
}

*****************2nd Program***********************

 

#include <iostream>
#include <cmath>
using namespace std;

double population(double year)
{
    double t = year - 1990.0;

    double population = 52.966 + 2.184*t;
   
    return population;
}

int main()
{
    int year;
    cout << "Enter the year after 1990> ";
    cin >> year;

    cout << "Predicted Gotham City population for " << year << " (in thousands):" << endl;
    cout << population(year) << endl;
    return 0;
}

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