Question

i want the code and the answer to last image question#4 please

By the way, we need to print values for velocity, acclaration, mass, all of the values
This program will prompt the user for the following input The distance an object traveled from point 1 to point 2 (variable distance) The time required to travel distance (variable time) The objects initial velocity (variable initVelocity) . The mass of the object (variable mass) You will need to write a series of functions that will calculate the force of the object using the instructions below. Each function should be independent from the others (i.e., the force function Lab Handout: Functions shouldnt call the acceleration function, and the acceleration function shouldnt call the velocity function) 1. Write a function that calculates the average velocity, using the equation v- (distance) (time) 2. Write a function that calculates the average acceleration using the equation a (v-vo)/(time) Where v is the current velocity and vo is the initial velocity. For your program, use the average velocity as the current velocity. Write another function that calculates the force of an object using the equation F=ma

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code for you:

#include <iostream>
using namespace std;
double Velocity(double distance, double time)
{
return distance / time;
}
double Acceleration(double velocity, double initVelocity, double time)
{
return (velocity - initVelocity) / time;
}
double Force(double mass, double acceleration)
{
return mass * acceleration;
}
int main()
{
double distance, initVelocity, mass, time;
cout<<"Enter the distance an object traveled from point1 to point2: ";
cin>>distance;
cout<<"Enter the time required to travel the distance: ";
cin>>time;
cout<<"Enter the object initial velocity: ";
cin>>initVelocity;
cout<<"Enter the mass of the object: ";
cin>>mass;
double velocity = Velocity(distance, time);
double acceleration = Acceleration(velocity, initVelocity, time);
double force = Force(mass, acceleration);
cout<<"Velocity: "<<velocity<<endl;
cout<<"Acceleration: "<<acceleration<<endl;
cout<<"Mass: "<<mass<<endl;
cout<<"Time: "<<time<<endl;
cout<<"Distance: "<<distance<<endl;
cout<<"Force: "<<force<<endl;
}

And the output screenshot is:

If the function is:

getForce(double distance, double time, double initialDistance, double mass)

{

return mass * getAcceleration(distance, initialDistance, time);

}

Here the code will be more reusable, and readable when compared to the code we wrote.

Add a comment
Know the answer?
Add Answer to:
i want the code and the answer to last image question#4 please By the way, we...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I want the math lab code for theses problems in a unique way

    I want the math lab code for theses problems in a unique way Theory A projectile is launched from point A up an incline plane that makes an angle of 10 with the horizontal. The mountain is 6,000 m high. Vo 10° Figure 1: Flightpath of a projectile. If we neglect the air resistance, the flight path of a projectile launched at an initial speed vo and an angle θ of departure relative to the horizontal is a parabola (see...

  • 2. A mass moves along a straight line, which we will call the x-axis with the...

    2. A mass moves along a straight line, which we will call the x-axis with the positive direction to the right. The equation for the turtle's position as a function of time is x(t) = 40.00cm + 16.00 en/s t-10.00cm/s2 t2 A. Find the object's initial velocity, initial position, and initial acceleration. B. At what time t is the velocity of the object zero? C. How long after starting does it take the object to return to its starting point?...

  • I have three questions I need assistance on please: 1. To make an object start moving...

    I have three questions I need assistance on please: 1. To make an object start moving on a surface with friction requires (a) less force than it takes to keep it moving on the surface at constant velocity (b) the same force as to keep it moving on the surface at constant velocity (c) more force than it takes to keep it moving on the surface at constant velocity (d) a force equal to the weight of the object (2)...

  • 5. (15 pts] A force acting on an object is proportional to the square root of...

    5. (15 pts] A force acting on an object is proportional to the square root of the distance the object moves. The equation for the distance r is: 19 = kyr, for some constant k. The object starts at t=0 with position r = 0 and velocity v = 0. The object moves four meters in the first second. That is, r(t = 1) = 4. (a) Find the object's velocity as a function of position, v(r). (b) Find the...

  • i also need the right answer for my last question in my second post EXERCISES 5.4...

    i also need the right answer for my last question in my second post EXERCISES 5.4 Integration Formulas and the Net Change EXERCISES 5.4 Integration Formulas and the Net Change Theorem Score: 12.17/14 12/14 answered Question 14 A 25-year old woman burns 300 - 80t cal/hr while walking on her treadmill. Her caloric intake from drinking Gatorade is 95t calories during the tth hour. What is her net decrease in calories after walking for 3 hours? calories burned Submit Question...

  • A test model for a new type of braking system is designed to apply a braking...

    A test model for a new type of braking system is designed to apply a braking force that decays following an exponential function. For an object moving in the (+) x direction (to the right), the force acts in the opposite direction. When the brakes are applied, the velocity change as a function of time in seconds can be approximated by . v=v(t) = V, e-At where Vo is a constant in [m/sec) and A is a constant in [1/sec)....

  • feet per second and in miles per second 18 An object of mass m is moving...

    feet per second and in miles per second 18 An object of mass m is moving horizontally through a medium which resists the motion with a force that is a func- tion of the velocity; that is, d's dv f(v) dt =m dt2 where v = s(1) represent the velocity and at time , respectively. For example, v(t) and s position of the object think of a boat moving through the water. (a) Suppose that the resisting force is proportional...

  • Question 4 An object has the velocity vector function v(t) (5, 4e4t, 6t + 2) and...

    Question 4 An object has the velocity vector function v(t) (5, 4e4t, 6t + 2) and initial position 7(0) = (5,4, – 4) A) Find the vector equation for the object's position. F(t) B) Find the vector equation for the object's acceleration. alt) > Add Work Submit Question

  • Using C programming Description: You have been tasked to design an application for an engineering...

    Using C programming Description: You have been tasked to design an application for an engineering firm to measure the performance of their vehicle designs. The user, an engineer will enter data into your program when prompted and will perform the required calculation and output the answer. The formula used for this project calculates the distance an object will cover in meters given an initial velocity, a rate of acceleration and a time of acceleration or travel. 1. Your program must...

  • Please answer the last 4 bullet points step by step. Again the last 4 bullet points....

    Please answer the last 4 bullet points step by step. Again the last 4 bullet points. k III.pdf 1) Up until now we have always ignored air resistance. We should now add . Let us just think of simple 1-dimensional problem, dropping a ball of mass m from a height H but 2 with air resistance. We can model the air resistance as a force proportional to the velocity, fair = bu. The coefficient b is a constant. (For this...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT