Calculates the velocity and momentum of an object

Assignment Help Basic Computer Science
Reference no: EM13726407

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 kg
1 90.01 90010
2 45.005 45005
3 30.0033 30003.3
4 22.5025 22502.5
5 18.002 18002
6 15.0017 15001.7
7 12.8586 12858.6
8 11.2513 11251.3
9 10.0011 10001.1
10 9.001 9001
11 8.18273 8182.73
12 7.50083 7500.83
13 6.92385 6923.85
14 6.42929 6429.29
15 6.00067 6000.67
16 5.62563 5625.63
17 5.29471 5294.71
18 5.00056 5000.56
19 4.73737 4737.37
20 4.5005 4500.5
21 4.28619 4286.19
22 4.09136 4091.36
23 3.91348 3913.48
24 3.75042 3750.42
25 3.6004 3600.4
26 3.46192 3461.92
27 3.3337 3333.7
28 3.21464 3214.64
29 3.10379 3103.79

Reference no: EM13726407

Questions Cloud

Using the types of entities found in the henry : Using the types of entities found in the Henry Books database (books, authors, and publishers), create an example of a table that is in first normal form but not in second normal form and an example of a table that is in second normal form but ..
Write about income inequality in the u.s. : Read the articles provided on moodle and write about income inequality in the U.S. One of the best ways of doing this is to start summarizing the articles.
Calculate the finance charge and monthly payment : Zachary Porter of Highland Heights, Kentucky, is contemplating borrowing $10,000 from his bank. The bank could use add-on rates of 6.5 percent for 3 years, 7 percent for 4 years, and 8 percent for 5 years. Use Equation 7.1 to calculate the finance ch..
Examine the components of a marketing plan : Examine the components of a marketing plan. Determine the component you believe to be the most important and the component you believe to be the least important. Provide a rationale for your response
Calculates the velocity and momentum of an object : 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 (..
The remaining balance of his initial mortgage : Da Feng is looking to refinance his home because rates have gone down since he purchased the house 5 years ago. He started with a 30-year fixed-rate mortgage of $213,000 at an annual rate of 6.70%. He has to make monthly payments. He can now get a 25..
How would you describe the marketing mix : In your own words, how would you describe the marketing mix? How does the act of selling fit into it? Feel free to include examples, How do salespeople contribute to our society? Are there negative aspects of personal selling from a societal pers..
A cyber-attack or information security breach : Find a recent article on a cyber-attack or information security breach. Submit a 1-2 page long summary of the article.
What is the ip address of your nic or network adapter : What is the IP address of your NIC or Network adapter? what is the IP address listed for your default gateway?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Determine many blocks of main memory in direct-mapped cache

Asumme that computer using direct-mapped cache has 2^24 words of main memory and cache of 64 blocks, where each cache block contains 16 words. How many blocks of main memory are there?

  Explain how is a dsl interconnection distinct from the

q1.what are the basic principles that apply to all networks?q2.what is an ethernet card?q3.what does a network switch

  Revise the solution to the balanced-braces problem

revise the solution to the balanced-braces problem so that the expression can contain three types of delimiters ( ), [ ], and { }: Thus {ab(c[d])e} is valid, but {ab(c))is not.

  Experience with pcap

The purpose of this assignment is to identify your experience with full packet capture.Research packet capture, and report on its usefulness in cyber security and network forensics.

  Perform in-depth research and provide an explanation

You will perform in-depth research and provide an explanation of how an issue associated with your selected topic relates to the consumption of digital media.

  Compare tcp and udp protocols

)You suspect that the failure of a router or of a transmission line connecting routers has left some of your important servers unavailable to clients at your site. How could you narrow down the location of the problem?

  What types of threats does the tool mitigate

Research various security tools that an employee can use to keep his or her data safe or to thwart denial of service attacks.

  Write an instruction sequence to set the contents of memory

write an instruction sequence to set the contents of memory locations at $1000, $1010, and $1020 to 10, 11, and 12 respectively

  Are robots remotely controlled by humans really robots

Are robots remotely controlled by humans really robots?

  One of the benefits of integration

One of the benefits of integration is that it lets developers leverage existing programs to develop new, value-added applications (called mashups). Instead of needing to re-develop services that already exist, a developer can use middleware to ..

  Thread problem

Implement what is kind of the inverse of our Producer - Consumer, where many Producers supply a limited capacity consumer.

  Question about flight function

An airline vice president in charge of operations requires to determine whether the current estimates of flight times are accurate. because there is a larger possiblity of variations due to wether and air traffic in the longer flights.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd