Question

In: Computer Science

(c++) the constant velocity of an object moving in straight line is defined as r= d/t,...

(c++) the constant velocity of an object moving in straight line is defined as r= d/t, where r is the speed, d is the distance and t is the time it takes to complete movement. write a program that will ask user to enter distance moved and the time needed to complete it. program should calculate speed of that object and print results on screen

Solutions

Expert Solution

Here is the C++ program, i have written condition to ensure we are not dividing the distance by zero. Here is screenshot and code

=================================================================================

#include<iostream>

using namespace std;

int main(void) {

double distance=0,time=0;

cout<<"Enter distance in (meters): ";
cin>>distance;

cout<<"Enter time in (seconds): ";
cin>>time;

if(time>0) {
double velocity = distance/time;
cout<<"Velocity: "<<velocity<<" m/sec"<<endl;
} else {
cout<<"Velocity undefined"<<endl;
}

}

=================================================================================

thanks !


Related Solutions

1) The position of an object moving along a straight line is s(t) = t^3 −...
1) The position of an object moving along a straight line is s(t) = t^3 − 15t^2 + 72t feet after t seconds. Find the object's velocity and acceleration after 9 seconds. 2) Given the function f (x ) =−3 x 2 + x − 8 , (a) Find the equation of the line tangent to f(x ) at the point (2, −2) . (b) Find the equation of the line normal to f(x ) at the point (2, −2)...
The velocity function for a particle moving along a straight line is given by v(t) =...
The velocity function for a particle moving along a straight line is given by v(t) = 2 − 0.3t for 0 ≤ t ≤ 10, where t is in seconds and v in meters/second. The particle starts at the origin. (a) Find the position and acceleration functions for this particle. (b) After ten seconds, how far is the particle from its starting point? (c) What is the total distance travelled by the particle in the interval [0, 10]?
The position function of an object moving along a straight line is given by the function...
The position function of an object moving along a straight line is given by the function t3 - 15t2 -48t -10, where s is in metres and t is in seconds and 0≤15≤t . [7A] a) When is the velocity of the object greater than 21 m/s? b) When is the speed of the object less than 21 m/s? c) Illustrate the graphical representation for each of the above."
An object is moving along a straight line, and the uncertainty in its position is 2.20...
An object is moving along a straight line, and the uncertainty in its position is 2.20 m. (a) Find the minimum uncertainty in the momentum of the object. Find the minimum uncertainty in the object's velocity, assuming that the object is (b) a golf ball (mass = 0.0450 kg) and (c) an electron.
1. Suppose the velocity of a moving object is given by the function f(t) = √...
1. Suppose the velocity of a moving object is given by the function f(t) = √ t for the time interval 0 ≤ t ≤ 2 sec. Approximate the total distance this object travels during this entire time interval with: (a) (4 pts) a Left-Hand Riemann sum using n = 4 rectangles. Write out the terms in the sum, but DO NOT evaluate it. (b) (4 pts) a Right-Hand Riemann sum using n = 6 rectangles. Write out the terms...
1). A car is moving along a straight line defined to be the positive x direction....
1). A car is moving along a straight line defined to be the positive x direction. Its velocity is measured and found to be a function of time given by Vx(t)=(alpha)t^2 , where alpha is a known constant. The car was at the point x = A at the time t = 2sec. Find the car's position as a function of time. How fast would the car be going just before it hits a wall located at x = L?...
1) Imagine an object moving horizontally with uniform (that is, constant) velocity. Sketch the position time...
1) Imagine an object moving horizontally with uniform (that is, constant) velocity. Sketch the position time and velocity-time graphs for this motion. 2) Imagine tossing an object straight up into the air, then catching it. Sketch the position-time and velocity-time graphs for this motion, from the moment it leaves your hand to the moment just before it lands in your hand. 3) Imagine tossing a ball slightly upwards and towards another person. Consider the motion from the moment the ball...
The velocity function of a particle moving along a line is given by the equation v(t)...
The velocity function of a particle moving along a line is given by the equation v(t) = t2 - 2t -3. The particle has initial position s(0) = 4. a. Find the displacement function b. Find the displacement traveled between t = 2 and t = 4 c. Find when the particle is moving forwards and when it moves backwards d. Find the total distance traveled between t = 2 and t = 4 e. Find the acceleration function, and...
you plot the position(x) vs. time(t) for an object moving at a constant acceleration. Will the...
you plot the position(x) vs. time(t) for an object moving at a constant acceleration. Will the slopes (velocity) be constant or not? why?
In order for an object of constant mass to be traveling with constant velocity, which of...
In order for an object of constant mass to be traveling with constant velocity, which of the following must be true? a. the net force acting on the mass must be zero b. it’s acceleration is constant c. the net force acting on the mass is greater than zero d. none of the above
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT