Skip to content

Revised solutions #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.ignoreWords": [
"esnext"
]
}
14 changes: 0 additions & 14 deletions exercises/part1-2.js

This file was deleted.

17 changes: 0 additions & 17 deletions exercises/part1-2.ts

This file was deleted.

16 changes: 0 additions & 16 deletions exercises/part3.js

This file was deleted.

19 changes: 0 additions & 19 deletions exercises/part3.ts

This file was deleted.

21 changes: 0 additions & 21 deletions exercises/part4.js

This file was deleted.

28 changes: 0 additions & 28 deletions exercises/part4.ts

This file was deleted.

14 changes: 10 additions & 4 deletions exercises/part5.js → exercises/parts1-5.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
// URL for the instructions:
// https://education.launchcode.org/intro-to-professional-web-dev/chapters/typescript/exercises.html
exports.__esModule = true;
// Add your import statement to line 2:
// Part 5: Import statement.
var SpaceLocation_1 = require("./SpaceLocation");
// Part 1: Remaining variables.
var kilometersToMars = 225000000;
var kilometersToTheMoon = 384400;
// Part 2: Content moved into class. Output statements updated.
// Part 3: Content moved into class. Output statements updated.
// Part 4: Define your Spacecraft class:
var Spacecraft = /** @class */ (function () {
function Spacecraft(name, speedMph) {
this.milesPerKilometer = 0.621;
Expand All @@ -20,8 +26,8 @@ var Spacecraft = /** @class */ (function () {
};
return Spacecraft;
}());
// Create an instance of Spacecraft:
var spaceShuttle = new Spacecraft('Discovery', 17500);
// Print the output for the trips to Mars and the moon:
// Create an instance of the class here:
var spaceShuttle = new Spacecraft('Determination', 17500);
// Part 5: Paste in the code from step 6 here:
spaceShuttle.printDaysToLocation(new SpaceLocation_1.SpaceLocation('Mars', kilometersToMars));
spaceShuttle.printDaysToLocation(new SpaceLocation_1.SpaceLocation('the Moon', kilometersToTheMoon));
23 changes: 18 additions & 5 deletions exercises/part5.ts → exercises/parts1-5.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
// Add your import statement to line 2:
// URL for the instructions:
// https://education.launchcode.org/intro-to-professional-web-dev/chapters/typescript/exercises.html

// Part 5: Import statement.
import { SpaceLocation } from './SpaceLocation';

// Part 1: Remaining variables.
let kilometersToMars: number = 225000000;
let kilometersToTheMoon: number = 384400;

// Part 2: Content moved into class. Output statements updated.


// Part 3: Content moved into class. Output statements updated.


// Part 4: Define your Spacecraft class:

class Spacecraft {
milesPerKilometer: number = 0.621;
name: string;
Expand All @@ -25,9 +37,10 @@ class Spacecraft {
}
}

// Create an instance of Spacecraft:
let spaceShuttle = new Spacecraft('Discovery', 17500);
// Create an instance of the class here:
let spaceShuttle = new Spacecraft('Determination', 17500);


// Print the output for the trips to Mars and the moon:
// Part 5: Paste in the code from step 6 here:
spaceShuttle.printDaysToLocation(new SpaceLocation('Mars', kilometersToMars));
spaceShuttle.printDaysToLocation(new SpaceLocation('the Moon', kilometersToTheMoon));
spaceShuttle.printDaysToLocation(new SpaceLocation('the Moon', kilometersToTheMoon));