Skip to content

Commit 5655885

Browse files
committed
calculated distance to mars and the moon in days. hooray!
1 parent 9803b43 commit 5655885

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
// Declare and assign the variables below
2+
let spaceShuttle = 'Determination';
3+
let shuttleSpeedMph = 17500;
4+
let distanceToMarsKm = 225000000;
5+
let distancetoMoonKm = 384400;
6+
const milesPerKm = 0.621;
7+
8+
29

310
// Use console.log to print the 'typeof' each variable. Print one item per line.
11+
// console.log(typeof (spaceShuttle));
12+
// console.log(typeof (shuttleSpeedMph));
13+
// console.log(typeof (distanceToMarsKm));
14+
// console.log(typeof (distancetoMoonKm));
15+
// console.log(typeof (milesPerKM));
16+
417

518
// Calculate a space mission below
19+
let milesToMars = distanceToMarsKm * milesPerKm;
20+
let hoursToMars = milesToMars / shuttleSpeedMph;
21+
let daysToMars = hoursToMars / 24;
22+
623

724
// Print the results of the space mission calculations below
25+
console.log(spaceShuttle + " will take " + daysToMars + " days to reach Mars");
826

927
// Calculate a trip to the moon below
10-
11-
// Print the results of the trip to the moon below
28+
let milesToMoon = distancetoMoonKm * milesPerKm;
29+
let hoursToMoon = milesToMoon / shuttleSpeedMph;
30+
let daysToMoon = hoursToMoon / 24;
31+
// Print the results of the trip to the moon below
32+
console.log(spaceShuttle + " will take " + daysToMoon + " days to reach the Moon");

0 commit comments

Comments
 (0)