diff --git a/bike-shop/src/stage3-methods.js b/bike-shop/src/stage3-methods.js index 2f2fc5a..e84e96a 100644 --- a/bike-shop/src/stage3-methods.js +++ b/bike-shop/src/stage3-methods.js @@ -28,7 +28,6 @@ Tire.prototype.isFlat = function () { Tire.prototype.puncture = function () { this._isFlat = true - //this.tires[0]._isFlat = true } diff --git a/bike-shop/src/stage4-inheritance.js b/bike-shop/src/stage4-inheritance.js index 2281fd5..e139f94 100644 --- a/bike-shop/src/stage4-inheritance.js +++ b/bike-shop/src/stage4-inheritance.js @@ -3,14 +3,69 @@ class Frame { } class Tire { - // your code here + } class Bike { - // your code here + constructor() { + this.tires = [new Tire, new Tire] + this.frame = new Frame + this.brakes = { + back : true, + front : true + } + this.rings = [3, 7] + } +} + +class MountainBike extends Bike { + constructor() { + super(); + this.tires[0].type = 'dirt'; + this.tires[1].type = 'dirt'; + this.frame.style = 'mountain'; + this.shocks = 20; + } + adjustShocks(newSagSetting){ + this.shocks = newSagSetting; + } +} + +class BMXBike extends Bike { + constructor() { + super(); + this.brakes.front = false; + this.tires[0].diameter = 20; + this.tires[1].diameter = 20; + } +} + +class RacingBike extends Bike { + constructor(val) { + super(val); + this.tires[0].type = 'road'; + this.tires[1].type = 'road'; + this.frame.style = 'racing'; + //work on this below + this.rings[0] = 3; + this.rings[1] = 10; + } + gearSpeeds(){ + return this.rings[0] * this.rings[1]; + } } + + +//let mountainBike = new MountainBike() +//let racingBike = new RacingBike() + + + module.exports = { Bike: Bike, + MountainBike: MountainBike, + BMXBike: BMXBike, + RacingBike: RacingBike // you'll need to export new classes here } diff --git a/index.html b/index.html index 2223032..82f542f 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,6 @@