Advertisement
bebo231312312321

Untitled

Feb 28th, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Laptop {
  2.    
  3.     isOn = false
  4.    
  5.     constructor (info, quality){
  6.        this.info = {
  7.         producer: info.producer,
  8.         age: info.age,
  9.         brand: info.brand,
  10.    
  11.        }
  12.     this.quality = quality
  13.     this.price= 800 - (this.info.age * 2) + (this.quality * 0.5)
  14.     }
  15.    
  16.     turnOn(){
  17.         this.isOn = true
  18.         this.quality--
  19.         this.price= 800 - (this.info.age * 2) + (this.quality * 0.5)
  20.        
  21.     };
  22.     turnOff(){
  23.         this.isOn = false
  24.         this.quality --
  25.         this.price =  800 - (this.info.age * 2) + (this.quality * 0.5)
  26.      
  27.     }
  28.       // get price(){
  29.           //  return
  30.       //  }
  31.         showInfo(){
  32.             return JSON.stringify({
  33.                 producer: this.info.producer,
  34.                 age: this.info.age,
  35.                 brand: this.info.brand
  36.             })
  37.         }
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement