Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Laptop {
- isOn = false
- constructor (info, quality){
- this.info = {
- producer: info.producer,
- age: info.age,
- brand: info.brand,
- }
- this.quality = quality
- this.price= 800 - (this.info.age * 2) + (this.quality * 0.5)
- }
- turnOn(){
- this.isOn = true
- this.quality--
- this.price= 800 - (this.info.age * 2) + (this.quality * 0.5)
- };
- turnOff(){
- this.isOn = false
- this.quality --
- this.price = 800 - (this.info.age * 2) + (this.quality * 0.5)
- }
- // get price(){
- // return
- // }
- showInfo(){
- return JSON.stringify({
- producer: this.info.producer,
- age: this.info.age,
- brand: this.info.brand
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement