Advertisement
bebo231312312321

Untitled

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