Answer to Question #236602 in C++ for Pnwzz

Question #236602
Write a C++ program to calculate the period of a conical pendulum (T) when a stone of mass 1 kg is whirled in a horizontal circle attached at the end of a 1.75 m long string and making an angle (in degrees) with the vertical is given by the user. The given below is the equation to calculate the period of a conical pendulum.

I cos 0

9

T

= 2n

1 = 1.75 m (length of the pendulum), g = 9.8 (acceleration due to gravity), and 8= half-angle of the conical

pendulum

• User may insert an angle above or equal to 30 and below 45" as the highest angle. • Then the program should calculate the period of a conical pendulum (1) for each angle until the angle

becomes 20".

. Consider gravity (g) as a constant. You are required to calculate the in radians by using the given formula (Pl = 3.14286 which is a constant).

Theta Ang/180.0 PI

• Use the necessary header files to do the calculation

Sample Output

Enter

35

34

33

32

Angle in Degrees: 35

2.40384 2.41832

2.43234

2.44591
1
Expert's answer
2021-09-13T12:49:44-0400
#include<math.h>
#include<iostream>
using namespace std;
float computing_cos(float x) {
    float number = 0.0001, t, deno, cos_X, cos_val;
    x = x * (3.142 / 180.0); 
    t = 1;
    cos_X = t;          
    cos_val = cos(x);
    int n = 1;
    do {
        deno = 2 * n * (2 * n - 1);
        t = -t * x * x / deno;
        cos_X = cos_X + t;
        n = n + 1;
    } while (number <= fabs(cos_val - cos_X));
    return cos_X;
}
int main(){
	float n =60;
	double pi  = 3.14286;
	cout<<"Enter the angle \n";
	int angle;
	cin>>angle;
	float l = 1.75;
	for(int i=angle; i>=20; i--){
		double T = 2 * pi * (sqrt((l * computing_cos(i)) / 9.8));
		cout<<"For  angle  "<< i <<"   period of a conical pendulum is: "<<T<<endl;
	}
	
}

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