class User {
    constructor(name) {
      this.name = name;
    }
    sayHello() {
      console.log(this.name);
    }
  }
  let user = new User("Laurence");
  user.sayHello();



class Animal {
    constructor(species, sounds) {
        this.species = species;
        this.sounds = sounds
    }
    speak() {
        console.log(this.species + ' ' + this.sounds);
    }
}
Animal.prototype.eat = function () {
    return this.species + ' is eating';
}
let cat = new Animal('cat', 'meow');
let dog = new Animal('dog', 'bark');
cat.speak();
console.log(dog.eat());
console.log(dog);


class Menu {
    #offer1 = 10;
    #offer2 = 20;
    constructor(val1, val2) {
        this.val1 = val1;
        this.val2 = val2;
    }
    get total(){
        return this.calTotal();
    }
    calTotal(){
        return (this.val1 * this.#offer1) + (this.val2 * this.#offer2);
    }
}
const val1 = new Menu(2,0);
const val2 = new Menu(1,3);
const val3 = new Menu(3,2);
console.log(val1.total);
console.log(val2.total);
console.log(val3.total);


class Employee {
    constructor(first, last, years) {
        this.first = first;
        this.last = last;
        this.years = years;
    }
}
const person1 = new Employee('Laurence', 'Svekis', 10);
const person2 = new Employee('Jane', 'Doe', 5);
const workers = [person1, person2];
workers.forEach((person) => {
    console.log(person.first + ' ' + person.last + '  has worked here ' + person.years + ' years');
})
