Skip to content

Commit dde41b8

Browse files
committed
Began shift to single .ts file for exercises.
1 parent ad301d6 commit dde41b8

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

exercises/part1-2.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// URL for the instructions:
2+
// https://education.launchcode.org/intro-to-professional-web-dev/chapters/typescript/exercises.html
3+
// Part 1: Add the 5 variables here
4+
var spacecraftName = "Determination";
5+
var speedMph = 17500;
6+
var kilometersToMars = 225000000;
7+
var kilometersToTheMoon = 384400;
8+
var milesPerKilometer = 0.621;
9+
// Code part 2 here:
10+
var milesToMars = kilometersToMars * milesPerKilometer;
11+
var hoursToMars = milesToMars / speedMph;
12+
var daysToMars = hoursToMars / 24;
13+
// Code the output statement here (use a template literal):
14+
console.log(spacecraftName + " would take " + daysToMars + " days to get to Mars.");
15+
// Part 3:
16+
// Code the "getDaysToLocation" function here:
17+
// Call the function and print the outputs for the Mars trip and the moon trip:

exercises/part1-2.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,28 @@
33

44
// Part 1: Add the 5 variables here
55

6+
let spacecraftName: string = "Determination";
7+
let speedMph: number = 17500;
8+
let kilometersToMars: number = 225000000;
9+
let kilometersToTheMoon: number = 384400;
10+
let milesPerKilometer: number = 0.621;
611

712

13+
// Code part 2 here:
14+
let milesToMars: number = kilometersToMars * milesPerKilometer;
15+
let hoursToMars: number = milesToMars/speedMph;
16+
let daysToMars: number = hoursToMars/24;
817

18+
// Code the output statement here (use a template literal):
19+
console.log(`${spacecraftName} would take ${daysToMars} days to get to Mars.`);
920

10-
// Code part 2 here:
1121

22+
// Part 3:
23+
// Code the "getDaysToLocation" function here:
1224

1325

1426

15-
// Code the output statement here (use a template literal):
27+
28+
29+
// Call the function and print the outputs for the Mars trip and the moon trip:
1630

exercises/part3.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// URL for the instructions:
22
// https://education.launchcode.org/intro-to-professional-web-dev/chapters/typescript/exercises.html
33

4-
let spacecraftName: string = "Determination";
5-
let speedMph: number = 17500;
6-
let kilometersToMars: number = 225000000;
7-
let kilometersToTheMoon: number = 384400;
8-
let milesPerKilometer: number = 0.621;
4+
// let spacecraftName: string = "Determination";
5+
// let speedMph: number = 17500;
6+
// let kilometersToMars: number = 225000000;
7+
// let kilometersToTheMoon: number = 384400;
8+
// let milesPerKilometer: number = 0.621;
99

1010
// Code the "getDaysToLocation" function here:
1111

0 commit comments

Comments
 (0)