File tree Expand file tree Collapse file tree 6 files changed +21
-11
lines changed Expand file tree Collapse file tree 6 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ var speedMph = 17500;
5
5
var kilometersToMars = 225000000 ;
6
6
var kilometersToTheMoon = 384400 ;
7
7
var milesPerKilometer = 0.621 ;
8
- // Part 3 - Define the ' getDaysToLocation' function here:
8
+ // Code the " getDaysToLocation" function here:
9
9
function getDaysToLocation ( kilometersAway ) {
10
10
var milesAway = kilometersAway * milesPerKilometer ;
11
11
var hours = milesAway / speedMph ;
12
12
return hours / 24 ;
13
13
}
14
- // Call the function and print the output here :
14
+ // Call the function and print the outputs for the Mars trip and the moon trip :
15
15
console . log ( spacecraftName + " would take " + getDaysToLocation ( kilometersToMars ) + " to get to Mars." ) ;
16
+ console . log ( spacecraftName + " would take " + getDaysToLocation ( kilometersToTheMoon ) + " to get to the Moon." ) ;
Original file line number Diff line number Diff line change @@ -7,12 +7,13 @@ let kilometersToMars: number = 225000000;
7
7
let kilometersToTheMoon : number = 384400 ;
8
8
let milesPerKilometer : number = 0.621 ;
9
9
10
- // Part 3 - Define the ' getDaysToLocation' function here:
10
+ // Code the " getDaysToLocation" function here:
11
11
function getDaysToLocation ( kilometersAway : number ) : number {
12
12
let milesAway : number = kilometersAway * milesPerKilometer ;
13
13
let hours : number = milesAway / speedMph ;
14
14
return hours / 24 ;
15
15
}
16
16
17
- // Call the function and print the output here:
18
- console . log ( `${ spacecraftName } would take ${ getDaysToLocation ( kilometersToMars ) } to get to Mars.` ) ;
17
+ // Call the function and print the outputs for the Mars trip and the moon trip:
18
+ console . log ( `${ spacecraftName } would take ${ getDaysToLocation ( kilometersToMars ) } to get to Mars.` ) ;
19
+ console . log ( `${ spacecraftName } would take ${ getDaysToLocation ( kilometersToTheMoon ) } to get to the Moon.` ) ;
Original file line number Diff line number Diff line change 1
1
var kilometersToMars = 225000000 ;
2
2
var kilometersToTheMoon = 384400 ;
3
- // Part 4 - Define your Spacecraft class here:
3
+ // Define your Spacecraft class here:
4
4
var Spacecraft = /** @class */ ( function ( ) {
5
5
function Spacecraft ( name , speedMph ) {
6
6
this . milesPerKilometer = 0.621 ;
@@ -14,5 +14,8 @@ var Spacecraft = /** @class */ (function () {
14
14
} ;
15
15
return Spacecraft ;
16
16
} ( ) ) ;
17
+ // Create an instance of the class here:
17
18
var spaceShuttle = new Spacecraft ( 'Discovery' , 17500 ) ;
19
+ // Print two outputs - one for the trip to Mars and one for the trip to the moon.
18
20
console . log ( spaceShuttle . name + " would take " + spaceShuttle . getDaysToLocation ( kilometersToMars ) + " days to get to Mars." ) ;
21
+ console . log ( spaceShuttle . name + " would take " + spaceShuttle . getDaysToLocation ( kilometersToTheMoon ) + " days to get to Mars." ) ;
Original file line number Diff line number Diff line change 1
1
let kilometersToMars : number = 225000000 ;
2
2
let kilometersToTheMoon : number = 384400 ;
3
3
4
- // Part 4 - Define your Spacecraft class here:
4
+ // Define your Spacecraft class here:
5
5
class Spacecraft {
6
6
milesPerKilometer : number = 0.621 ;
7
7
name : string ;
@@ -20,6 +20,9 @@ class Spacecraft {
20
20
21
21
}
22
22
23
+ // Create an instance of the class here:
23
24
let spaceShuttle = new Spacecraft ( 'Discovery' , 17500 ) ;
24
25
26
+ // Print two outputs - one for the trip to Mars and one for the trip to the moon.
25
27
console . log ( `${ spaceShuttle . name } would take ${ spaceShuttle . getDaysToLocation ( kilometersToMars ) } days to get to Mars.` ) ;
28
+ console . log ( `${ spaceShuttle . name } would take ${ spaceShuttle . getDaysToLocation ( kilometersToTheMoon ) } days to get to Mars.` ) ;
Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
exports . __esModule = true ;
3
- // Part 5 - Add your import statement to line 2:
3
+ // Add your import statement to line 2:
4
4
var SpaceLocation_1 = require ( "./SpaceLocation" ) ;
5
5
var kilometersToMars = 225000000 ;
6
6
var kilometersToTheMoon = 384400 ;
7
- // Part 4 - Define your Spacecraft class here:
8
7
var Spacecraft = /** @class */ ( function ( ) {
9
8
function Spacecraft ( name , speedMph ) {
10
9
this . milesPerKilometer = 0.621 ;
@@ -21,6 +20,8 @@ var Spacecraft = /** @class */ (function () {
21
20
} ;
22
21
return Spacecraft ;
23
22
} ( ) ) ;
23
+ // Create an instance of Spacecraft:
24
24
var spaceShuttle = new Spacecraft ( 'Discovery' , 17500 ) ;
25
+ // Print the output for the trips to Mars and the moon:
25
26
spaceShuttle . printDaysToLocation ( new SpaceLocation_1 . SpaceLocation ( 'Mars' , kilometersToMars ) ) ;
26
27
spaceShuttle . printDaysToLocation ( new SpaceLocation_1 . SpaceLocation ( 'the Moon' , kilometersToTheMoon ) ) ;
Original file line number Diff line number Diff line change 1
- // Part 5 - Add your import statement to line 2:
1
+ // Add your import statement to line 2:
2
2
import { SpaceLocation } from './SpaceLocation' ;
3
3
4
4
let kilometersToMars : number = 225000000 ;
5
5
let kilometersToTheMoon : number = 384400 ;
6
6
7
- // Part 4 - Define your Spacecraft class here:
8
7
class Spacecraft {
9
8
milesPerKilometer : number = 0.621 ;
10
9
name : string ;
@@ -26,7 +25,9 @@ class Spacecraft {
26
25
}
27
26
}
28
27
28
+ // Create an instance of Spacecraft:
29
29
let spaceShuttle = new Spacecraft ( 'Discovery' , 17500 ) ;
30
30
31
+ // Print the output for the trips to Mars and the moon:
31
32
spaceShuttle . printDaysToLocation ( new SpaceLocation ( 'Mars' , kilometersToMars ) ) ;
32
33
spaceShuttle . printDaysToLocation ( new SpaceLocation ( 'the Moon' , kilometersToTheMoon ) ) ;
You can’t perform that action at this time.
0 commit comments