Skip to content

Commit 5e346a0

Browse files
authored
Merge pull request #1 from SyedAlvi22/Mariah-LaunchCode-DataTypeExercise-1
Added changes for space mission to Mars and Moon to data-and-variable…
2 parents 9803b43 + b839f44 commit 5e346a0

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed
Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
// Declare and assign the variables below
1+
// Declare and assign the variables
2+
let shuttleName = 'Determination';
3+
let shuttleSpeedMph = 17500;
4+
let distanceToMarsKm = 225000000;
5+
let distanceToMoonKm = 384000;
6+
const milesPerKm = 0.621;
27

3-
// Use console.log to print the 'typeof' each variable. Print one item per line.
8+
// Use console.log to print the 'typeof' each variable
9+
console.log(typeof shuttleName); // Should print 'string'
10+
console.log(typeof shuttleSpeedMph); // Should print 'number'
11+
console.log(typeof distanceToMarsKm); // Should print 'number'
12+
console.log(typeof distanceToMoonKm); // Should print 'number'
13+
console.log(typeof milesPerKm); // Should print 'number'
414

5-
// Calculate a space mission below
15+
// Calculate a space mission to Mars
16+
let milesToMars = distanceToMarsKm * milesPerKm;
17+
let hoursToMars = milesToMars / shuttleSpeedMph;
18+
let daysToMars = hoursToMars / 24;
619

7-
// Print the results of the space mission calculations below
20+
// Print the results of the space mission to Mars
21+
console.log(${shuttleName} will take ${daysToMars} days to reach Mars.);
822

9-
// Calculate a trip to the moon below
23+
// Calculate a trip to the Moon
24+
let milesToMoon = distanceToMoonKm * milesPerKm;
25+
let hoursToMoon = milesToMoon / shuttleSpeedMph;
26+
let daysToMoon = hoursToMoon / 24;
1027

11-
// Print the results of the trip to the moon below
28+
// Print the results of the trip to the Moon
29+
console.log(${shuttleName} will take ${daysToMoon} days to reach the Moon.);

0 commit comments

Comments
 (0)