Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow the instruction and complete the partially completed program. partially completed program: /*------------------------------------------------- File: parachutist.c (Lab 5) Author: Description: Calculates change in velocity for the

Follow the instruction and complete the partially completed program.

image text in transcribed

image text in transcribed

partially completed program:

/*------------------------------------------------- File: parachutist.c (Lab 5) Author: Description: Calculates change in velocity for the parachutist over time and displays a table showing the results. -------------------------------------------------*/ #include #include #include

// Define symbolic constant #define G 9.8 // in m/s^2 #define N 50 // number of data points to compute #define TRUE 1 #define FALSE 0

// Declaration of a structure for user input typedef struct { // Add the members to the structure

} PARACHUTIST; // Function prototypes void getInput(PARACHUTIST *); void computeVelocity(PARACHUTIST *); void displayTable(PARACHUTIST *);

/*------------------------------------------------------------- Function: main Description: This function controls the overall program. It makes three calls, one to get user input, one to compute time/velocity data points, and a third to display the calculated values in a table. -------------------------------------------------------------*/

void main() { PARACHUTIST para; // A structure variable with parachutist data // Get input from user

// Compute time/velocity data points

// Display the results

}

/*--------------------------------------------------------------------------- Function: getInput Parameters pPrt - pointer to a PARACHUTIST structure variable Description: Obtains from the user, the weight, drag and final time values and stores in the referenced data structure. All values must be greater than zero. --------------------------------------------------------------------------*/ void getInput(PARACHUTIST *pPtr) { // Declaration of variable

// Get input from user

}

/*--------------------------------------------------------------------------- Function: computeVelocity Parameters pPrt - pointer to a PARACHUTIST structure variable Description: Using the weight, drag and final time values in the referenced structure, computes and stores N+1 points in the two arrays found in the referenced structure variable. --------------------------------------------------------------------------*/ void computeVelocity(PARACHUTIST *pPtr) { // Declaration of variables

// Calculate the velocity points and store in the arrays

}

/*--------------------------------------------------------------------------- Function: displayTable Parameters pPrt - pointer to a PARACHUTIST structure variable Description: Displays a table of the calculated data points. --------------------------------------------------------------------------*/ void displayTable(PARACHUTIST *pPtr) { // Declaration of variables int ix; // index into arrays // Display results printf("The change in velocity of the parachutist with weight %.2f kg and a drag coefficient %.2f kg/s is as follows. ", pPtr->weight, pPtr->drag); printf("%10s %10s ","Time t", "Velocity v"); printf("------------------------ "); // Display the contents of the table.

}

C. Exercise: Revisiting the Free Falling Parachutist - Using Loops to work with Arrays (60 marks) It's time to revisit again the program that computes how the velocity of a parachutist changes between t- 0 and time t-(where t-0 is when the parachutist jumped out of a hot air balloon and his or her velocity is zero. The parachute is open immediately). You shall use a loop to update the contents of arrays with time/velocity data points and a table is used to display the results. The program is very similar to the one in exercise A, but there are some differences. Recall that the velocity as a function of time, v(t), is calculated as gm The following table provides a test case that can be used for testing the software (this table was generated using Microsoft Excel, see the file GNG1106LabSTestCases.xls). The velocity is computed using the above equation. Weight Drag Coefficient Final Time Time t Velocity TimetVelocity 0.00 0.00 6.24 2.306.48 6.72 6.96 36.41 0.48 0.72 0.96 4.50 37.84 38.51 39.15 39.76 40.35 40.91 8.63 0.55 12.40 7.44 7.68 7.92 1.44 15.86 17.48 19.02 20.50 21.92 23.28 24.58 8.40 8.64 8.88 41.97 42.46 42.93 43.38 43.81 44.22 44.62 45.00 45.36 45.71 46.04 46.35 46.66 46.95 47.22 47.49 2.88 68.1 12.5 12.0 9.36 9.60 9.84 27.0110.08 3.84 4.08 4.32 4.56 4.80 5.04 5.28 5.52 5.76 6.00 29.23 10.56 32.22 11.28 33.13 11.52 34.84 12.00 35.64 artially completed program A project containing a p Here are a few notes/guidelines is provided. Your task is to complete the program. The program's tasks are divided into three functions, one for getting user input (getInput), one for computing data points (computeVelocity) and one for displaying the table of results (displayTable). A single structure contains all data related to the parachutist including the input data (weight, drag and final time) as well as output data (an array with time values and an array with velocity values). You must add the members to this structure C. Exercise: Revisiting the Free Falling Parachutist - Using Loops to work with Arrays (60 marks) It's time to revisit again the program that computes how the velocity of a parachutist changes between t- 0 and time t-(where t-0 is when the parachutist jumped out of a hot air balloon and his or her velocity is zero. The parachute is open immediately). You shall use a loop to update the contents of arrays with time/velocity data points and a table is used to display the results. The program is very similar to the one in exercise A, but there are some differences. Recall that the velocity as a function of time, v(t), is calculated as gm The following table provides a test case that can be used for testing the software (this table was generated using Microsoft Excel, see the file GNG1106LabSTestCases.xls). The velocity is computed using the above equation. Weight Drag Coefficient Final Time Time t Velocity TimetVelocity 0.00 0.00 6.24 2.306.48 6.72 6.96 36.41 0.48 0.72 0.96 4.50 37.84 38.51 39.15 39.76 40.35 40.91 8.63 0.55 12.40 7.44 7.68 7.92 1.44 15.86 17.48 19.02 20.50 21.92 23.28 24.58 8.40 8.64 8.88 41.97 42.46 42.93 43.38 43.81 44.22 44.62 45.00 45.36 45.71 46.04 46.35 46.66 46.95 47.22 47.49 2.88 68.1 12.5 12.0 9.36 9.60 9.84 27.0110.08 3.84 4.08 4.32 4.56 4.80 5.04 5.28 5.52 5.76 6.00 29.23 10.56 32.22 11.28 33.13 11.52 34.84 12.00 35.64 artially completed program A project containing a p Here are a few notes/guidelines is provided. Your task is to complete the program. The program's tasks are divided into three functions, one for getting user input (getInput), one for computing data points (computeVelocity) and one for displaying the table of results (displayTable). A single structure contains all data related to the parachutist including the input data (weight, drag and final time) as well as output data (an array with time values and an array with velocity values). You must add the members to this structure

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Baccalaureate Computer Science HL And SL Option A Databases Part I Basic Concepts

Authors: H Sarah Shakibi PhD

1st Edition

1542457084, 978-1542457088

More Books

Students also viewed these Databases questions

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago