Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91265786

Have any Question?


Related Questions in Computer Engineering

A large furniture retailer wants to conduct a customer

A large furniture retailer wants to conduct a customer satisfaction survey. Customers are divided into groups based on the amount of money they have spent at the retailer's stores in the past year: less than $2000, from ...

Question suppose that an attack would do 200000 in damage

Question : Suppose that an attack would do $200,000 in damage and has a 25% annual probability of success. Spending $15,000 per year on Countermeasure A would reduce the damage of a successful attack by 50%. a) Do a risk ...

Section 1 introduction write an introduction statement

Section 1: Introduction Write an introduction statement introducing the topic that you are interested in exploring. This section should contain the following background: Identify an industry and company profile you wish ...

What are the three most significant aspects of threat which

What are the three most significant aspects of threat which will continue to evolve for the next 20 years?

Risky business how can us companies protect their digital

Risky Business: How Can U.S. Companies Protect their Digital Assets Overseas? Prepare a 3 to 5 paragraph briefing statement that can be used to answer the above question. Your audience will be attendees at a conference f ...

Question sunshine health corporation is seeking to improve

Question : Sunshine Health Corporation is seeking to improve overall connectivity across their corporate campus near the Hawaii Kai Marina, Honolulu, Hawaii. The campus buildings have recently been updated, thus the LANs ...

Question 1 assume that you are the project manager for an

Question: 1) Assume that you are the project manager for an upcoming new information systems project designed to replace your organization's old inventory management system. The server and database will also be upgraded. ...

Answer the following question whats the difference between

Answer the following Question : What's the difference between public, protected, and private members? What's the difference between static binding and dynamic binding?

Question suppose you are tasked with designing the security

Question : Suppose you are tasked with designing the security system for a new web browser that supports rendering web pages with embedded web page scripts. What checks would you need to implement to ensure that executin ...

Stockholdingwrite a class stockholding the purpose of a

StockHolding Write a class StockHolding. The purpose of a StockHolding object is to represent a single stock in someone's investment portfolio. The StockHolding class has the following specification: instance variable of ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As