Answered You can hire a professional tutor to get the answer.

QUESTION

Use the program, Passing-by-value, on the bottom of pp. 261 and the program, Passing-by-pointer Due, on pp. Write a program that does the following:

Use the program, Passing-by-value, on the bottom of pp. 261 and the program, Passing-by-pointer Due, on pp. 262 as a starting point for this assignment.· Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula for Momentum is m=mass*velocity. Your program should consist of two functions: Passing By Values (one), One Passing By Pointers (one). It should also have a for loop and necessary print statements to print the result in a tabular format.· The Passing By Values function is to calculate the velocity of the object, where you pass two parameters to this function a constant distance, but the time is the value of the for loop: I=1: double Velocity(double distance,int time);· The Pass By Pointers function calculates the momentum of the object, where you pass two parameters to this function: The Velocity and a constant mass of an object: mass=100: double Momentum(double *Velocity,double *mass);The output should have a tabular format consisting of Time, Velocity, and Momentum. There is no need for a user to enter a value, and the time input should range from 1-200.Note: Make sure that you test the logic of your code to ensure the right result is generated. The code should produce an output similar to below example:Note: Everyone's result may vary based on his or her mass+distance initial values.Time in s Velocity in ms Momentum kg1 90.01 900102 45.005 450053 30.0033 30003.34 22.5025 22502.55 18.002 180026 15.0017 15001.77 12.8586 12858.68 11.2513 11251.39 10.0011 10001.110 9.001 900111 8.18273 8182.7312 7.50083 7500.8313 6.92385 6923.8514 6.42929 6429.2915 6.00067 6000.6716 5.62563 5625.6317 5.29471 5294.7118 5.00056 5000.5619 4.73737 4737.3720 4.5005 4500.521 4.28619 4286.1922 4.09136 4091.3623 3.91348 3913.4824 3.75042 3750.4225 3.6004 3600.426 3.46192 3461.9227 3.3337 3333.728 3.21464 3214.6429 3.10379 3103.79Press any key to continue . . .

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question