Write a program that computes how many feet an object falls in 1 second, 2 secon
ID: 3802946 • Letter: W
Question
Write a program that computes how many feet an object falls in 1 second, 2 seconds, etc., up to 12 seconds.
program should: 1. Have a procedure called FallingDistance which has one input parameter, seconds, and one output parameter, distance. 2. Compute the distance in feet an object falls using this formula: d = ½ gt2 (where g = 32.2) 3. The main program should call FallingDistance within a loop which passes the values 1 through 12 as arguments. 4. Print a table with seconds and falling distance in feet
I did this on Visual Studios and when i debug it all my answers are zero, this is the program i came up with
#include <iostream>
#include <iomanip>
using namespace std;
const double g = 32.2;
double fallingdistance (int seconds=0);
int main()
{
int seconds = 0;
double distance = 0;
cout << "Falling Distance ";
for (int i = 1; i <= 1; i++)
{
distance = fallingdistance(i);
cout << i << "seconds:" << distance << "distance ";
}
return 0;
}
double fallingdistance(int seconds);
{
distance = (.5* g) * (pow(seconds, 2));
return distance;
}
Explanation / Answer
I have created the flowchart and now I need to write it in C++ using visual basic. This is what I have so far. (Yes I know its wrong.. probably by alot.. I have tried as you can see
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.