-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlanets.cpp
More file actions
106 lines (85 loc) · 2.36 KB
/
Copy pathPlanets.cpp
File metadata and controls
106 lines (85 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <iostream>
#include <cmath>
#include <numbers>
using namespace std;
class Planet{
private:
double mass;
double gravitationalconstant;
double orbitvelocity;
double orbitperiod;
double temperature;
double atmosphericpressure;
double radius;
int numberofmoons;
string name;
public:
Planet(double m, double gc, double ov, double op, double t, double ap, double r, int moon, string n){
mass=m;
gravitationalconstant=gc;
orbitvelocity=ov;
orbitperiod=op;
temperature=t;
atmosphericpressure=ap;
numberofmoons=moon;
radius=r;
name=n;
}
double thermalpower(){
double pi = M_PI;
double stefanboltzman=5.670374419*pow(10,-8);
double tpower=4*pi*radius*radius*stefanboltzman*pow(temperature,4);
return tpower;
}
double vescape(){
double pi = M_PI;
double VESCAPE = pi*(2*gravitationalconstant*mass)/2;
return VESCAPE;
}
double magneticfeild(double md){
double pi = M_PI;
double n = 4*pi*10e-7;
double B = (n/(4*pi)) * md/pow(radius,3);
return B;
}
};
int main(){
double GC;
double M;
double R;
double V;
double OV;
double OP;
double AP;
double T;
double MD;
int MOON;
string N;
cout << "Enter name of planet: ";
cin >> N;
cout<<"Enter Magnetic Dipole of planet: ";
cin >> MD;
cout << "Enter gravitational constant of planet: ";
cin >> GC;
cout << "Enter mass of the planet: ";
cin >> M;
cout << "Enter Radius of planet: ";
cin >> R;
cout << "Enter orbit velocity of planet: ";
cin >> OV;
cout << "Enter orbit period of planet: ";
cin >> OP;
cout << "Enter atmospheric pressure of planet: ";
cin >> AP;
cout << "Enter temperature of planet: ";
cin >> T;
cout << "Enter # of moons: ";
cin >> MOON;
Planet p1(M, GC, OV, OP, T, AP, R, MOON, N);
double Tpower=p1.thermalpower();
cout<<"Thermal Power of Planet: " << Tpower;
double vESCAPE=p1.vescape();
cout<<"velocity needed to escape Planet's gravitational feild: " << vESCAPE;
double MagneticFeild=p1.magneticfeild(MD);
cout<<"Magnetic Feild of planet: : " << MagneticFeild;
}