Skip to content

Commit 74aa74c

Browse files
committed
Calculate a space mission! Exercise
1 parent abe8c86 commit 74aa74c

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed
Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
// Declare and assign the variables below
2+
let shuttleName = 'Determination';
3+
let shuttleSpeed = 17500;
4+
let marsDistance = 225000000;
5+
let moonDistance = 384400;
6+
const milesKilometer = 0.621;
27

38
// Use console.log to print the 'typeof' each variable. Print one item per line.
49

10+
console.log(typeof shuttleName);
11+
console.log(typeof shuttleSpeed);
12+
console.log(typeof marsDistance);
13+
console.log(typeof moonDistance);
14+
console.log(typeof milesKilometer);
15+
516
// Calculate a space mission below
617

18+
let milesToMars = marsDistance * milesKilometer;
19+
let hoursToMars = milesToMars / shuttleSpeed;
20+
let daysToMars = hoursToMars / 24;
21+
722
// Print the results of the space mission calculations below
823

24+
console.log(shuttleName + " will take " + daysToMars + " days to reach the Moon.");
25+
926
// Calculate a trip to the moon below
1027

11-
// Print the results of the trip to the moon below
28+
let milesToMoon = moonDistance * milesKilometer;
29+
let hoursToMoon = milesToMoon / shuttleSpeed;
30+
let daysToMoon = hoursToMoon / 24;
31+
32+
// Print the results of the trip to the moon below
33+
34+
console.log(shuttleName + " will take " + daysToMoon + " days to reach the Moon.");

0 commit comments

Comments
 (0)