Skip to content

Commit b99d702

Browse files
committed
Mission to Mars and Moon now calculated
1 parent 9803b43 commit b99d702

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed
Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
// Declare and assign the variables below
2-
2+
let name = "Determination";
3+
let speed = 17500;
4+
let distanceToMars = 225000000;
5+
let distanceToMoon = 384400;
6+
let mpk =0.621
37
// Use console.log to print the 'typeof' each variable. Print one item per line.
4-
8+
console.log(typeof(name))
9+
console.log(typeof(speed))
10+
console.log(typeof(distanceToMars))
11+
console.log(typeof(distanceToMoon))
12+
console.log(typeof(mpk))
513
// Calculate a space mission below
14+
let milesToMars = (distanceToMars*mpk)
15+
console.log(milesToMars)
16+
let hoursToMars = (milesToMars/speed)
17+
console.log(hoursToMars)
18+
let daysToMars = (hoursToMars/24)
19+
console.log(daysToMars)
620

721
// Print the results of the space mission calculations below
8-
22+
console.log(name + " will take " + daysToMars + " days to reach Mars.")
923
// Calculate a trip to the moon below
24+
let milesToMoon = (distanceToMoon*mpk)
25+
console.log (milesToMoon)
26+
let hoursToMoon = (milesToMoon/speed)
27+
console.log (hoursToMoon)
28+
let daysToMoon = (hoursToMoon/24)
29+
console.log (daysToMoon)
1030

11-
// Print the results of the trip to the moon below
31+
// Print the results of the trip to the moon below
32+
console.log(name + " will take " + daysToMoon + " days to reaach the Moon.")

0 commit comments

Comments
 (0)