Skip to content

Commit 30bab77

Browse files
committed
Mars and Moon Calculations
1 parent 9e88293 commit 30bab77

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
// Declare and assign the variables below
2-
2+
let nameOfSpaceShuttle = "Determination";
3+
let shuttleSpeedMph = 17500;
4+
let distanceToMarsKm = 225000000;
5+
let distanceToMoonKm = 384400;
6+
const milesPerKilometer = .621;
37
// Use console.log to print the 'typeof' each variable. Print one item per line.
4-
8+
console.log(typeof(nameOfSpaceShuttle));
9+
console.log(typeof(shuttleSpeedMph));
10+
console.log(typeof(distanceToMarsKm));
11+
console.log(typeof(distanceToMoonKm));
12+
console.log(typeof(milesPerKilometer));
513
// Calculate a space mission below
6-
14+
let milesToMars = distanceToMarsKm * milesPerKilometer;
15+
let hoursToMars = milesToMars/shuttleSpeedMph;
16+
let daysToMars = hoursToMars/24;
717
// Print the results of the space mission calculations below
8-
18+
console.log(nameOfSpaceShuttle + " will take " + daysToMars + " days to reach Mars.");
919
// Calculate a trip to the moon below
10-
11-
// Print the results of the trip to the moon below
20+
let milesToMoon = distanceToMoonKm * milesPerKilometer;
21+
let hoursToMoon = milesToMoon/shuttleSpeedMph;
22+
let daysToMoon = hoursToMoon/24;
23+
// Print the results of the trip to the moon below
24+
console.log(nameOfSpaceShuttle + " will take " + daysToMoon + " days to reach the Moon.");

data-and-variables/exercises/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)