File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
data-and-variables/exercises Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
1
// Declare and assign the variables below
2
+ let shuttleName = "Determination" ;
3
+ let speed = 17500 ;
4
+ let distToMars = 225000000 ;
5
+ let distToMoon = 384400 ;
6
+ let mpk = 0.621 ;
2
7
3
8
// Use console.log to print the 'typeof' each variable. Print one item per line.
9
+ console . log ( typeof shuttleName ) ;
10
+ console . log ( typeof speed ) ;
11
+ console . log ( typeof distToMars ) ;
12
+ console . log ( typeof distToMoon ) ;
13
+ console . log ( typeof mpk ) ;
4
14
5
15
// Calculate a space mission below
6
16
17
+ let milesToMars = mpk * distToMars ;
18
+
19
+ //miles/shuttle speed
20
+ let hoursToMars = milesToMars / speed ;
21
+
22
+ let daysToMars = hoursToMars / 24 ;
23
+
7
24
// Print the results of the space mission calculations below
25
+ console . log ( shuttleName + " will take " + daysToMars + " days to reach Mars." ) ;
8
26
9
27
// Calculate a trip to the moon below
10
28
11
- // Print the results of the trip to the moon below
29
+ let milesToMoon = mpk * distToMoon ;
30
+
31
+ let hoursToMoon = milesToMoon / speed ;
32
+
33
+ let daysToMoon = hoursToMoon / 24 ;
34
+
35
+ // Print the results of the trip to the moon below
36
+
37
+ console . log ( shuttleName + " will take " + daysToMoon + " days to reach the Moon." ) ;
38
+ console . log ( shuttleName ) ;
39
+
You can’t perform that action at this time.
0 commit comments