Answer to Question #236600 in C++ for shoun

Question #236600

Write a C++ program to calculate time dilation (t) in motion, when the speed of the moving objects (v) is given by the user. The given below is the equation to calculate the time dilation.




v = speed of the moving object, c = 15000 ms-1(speed of light), and t0 = 75 s (time in observers own frame of reference)

  • User may insert the speed of the moving objects (v) above or equal to 100 ms-1 and below 200 ms-1 as the highest speed.
  • Consider the speed of light (c) as a constant value.
  • Then the program should calculate the time dilation (t) for each speed of the moving object until the speed becomes 89 ms-1.
  • Use the necessary header files to do the calculation.
1
Expert's answer
2021-09-13T18:40:05-0400
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int v, c,t0;
	cout<<"Enter the speed of the moving object: ";
	cin>>v;
	if(v>=100 & v<=200){
	float t=75/pow((1-pow((v-89),2)/(15*15)),0.2);
	cout<<"time dilation is: "<<t<<"s";
	}
	else if(v<100){
		cout<<"The speed is too low ";
	}
	else{
		cout<<"Speed is too high";
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS