Question: I need some help to complete Part 2 Inheritence (JavaScript) For your help, here is the description of Hotel Class thats the code for part1

I need some help to complete Part 2 Inheritence (JavaScript) I need some help to complete Part 2 Inheritence (JavaScript) For your

For your help,

here is the description of Hotel Class

help, here is the description of Hotel Class thats the code for

part1 class Hotel{//class Hotel //constructor constructor(name,rooms,booked,gym,city){ this.name=name; this.rooms=rooms; this.booked=booked; this.gym=gym; this.city=city; this.roomTypes=["twin","double","suite"];

thats the code for part1 class Hotel{//class Hotel //constructor constructor(name,rooms,booked,gym,city){ this.name=name; this.rooms=rooms; this.booked=booked; this.gym=gym; this.city=city; this.roomTypes=["twin","double","suite"]; this.swimmingPool=true; this.airportShuttle=false; this.restaurants=[["Harolds", "American"], ["Kyoto", "Japanese"], ["Relax", "Fusion"]]; } //Setter methods set Name(name){ this.name=name; } set Rooms(rooms){ this.rooms=rooms; } set Booked(booked){ this.booked=booked; } set Gym(gym){ this.gym=gym; } set City(city){ this.city=city; } //Getter methods get Name(){ return this.name; } get Rooms(){ return this.rooms; } get Booked(){ return this.booked; } get Gym(){ return this.gym; } get City(){ return this.city; } get RoomTypes(){ return this.roomTypes; } get SwimmingPool(){ return this.swimmingPool; } get AirportShuttle(){ return this.airportShuttle; } get Restaurants(){ return this.restaurants; } bookRoom(){ this.booked+=1; console.log("You have booked a room. There are now ",this.rooms-this.booked," rooms available today."); } cancelRoom(){ this.booked-=1; console.log("You have cancelled your room. There are now ",this.rooms-this.booked," rooms available today."); } } //Hotel object const hotel=new Hotel("Marriott",40,25,true,"Richmond"); console.log("The hotel is a ",hotel.Name," located in ",hotel.city); console.log("There are ",hotel.Rooms-hotel.Booked," rooms available today"); hotel.bookRoom(); hotel.cancelRoom(); console.log("The available rooms are: ",hotel.RoomTypes.join(",")); console.log("Hotel has a shuttle? ",hotel.AirportShuttle); console.log("Hotel has a swimming pool? ",hotel.SwimmingPool); console.log("Hotel has 3 restaurants each with a different theme. They are:"); for (let [key, value] of hotel.restaurants) { console.log(key,":",value); }

PART 2 - Inheritance Create a new class called Resort that inherits from the Hotel class. Resort has two new properties: resortType (string) - what type of resort is it? (for example "singles", "family") beachfront (boolean) is the resort on the beach? kidsClub (boolean) - does the resort have a kids club? Create a constructor for this new class that initializes the three new properties. Create getter and setter functionality for the new class. Test the class by performing the following steps shown in Figure 2. Part 2 A new Resort has been created: Renaissance Phuket located in Phuket. It is a family resort Is it on the beach? true Does it have a kids club? true Oh Nol The kids club is being renovated! Does it have a kids club? false Figure 2. Testing the newly created class Resort that extends the Hotel class Your task is to create a Hotel class (using ES6). The properties of this hotel are: .name (string) - the name of the hotel(for example, "Marriott) rooms (number) - number of rooms in the hotel (for example, 40). booked (number) - number of rooms that have been booked (for example, 25) gym (Boolean) - does the hotel have a gym? (for example, true) roomTypes (array) - what types of rooms (for example, "twin", "double", "suite") location (string) - for example, "Vancouver" swimmingpool (boolean) - true or false .airportShuttle (boolean) - true or false restaurants (map) - should contain a map that has the restaurant name and restaurant type with three restaurants and the type of food they serve. For example: Harolds - American, Kyoto - Japanese, Relax - Fusion. For this lab assignment, using ES6, you must create the Hotel Class. You must create a constructor that sets the following 5 properties: 1. Name 2. City 3. Rooms 4. Booked 5. Gym Additional Methods: Please create the following code add "getter" and "setter" methods for the 5 constructor properties. bookRoom() - this method should add 1 to the booked property and display a message that the room was booked and that there are x rooms remaining for booking cancelRoom () - this method should remove 1 from the booked property and display a message that the room was cancelled and that there are x rooms remaining for booking. Write JavaScript code to demonstrate the functionality of all of the properties and methods for your new object. You must implement the following tests: Display the hotel name and location Display how many rooms are available Book a room, show how many rooms are available Cancel a room, show how many rooms are available Add a room type (honeymoon), display the room types now available Display whether the hotel has a pool (true or false) Display all of the restaurants (name and theme) that are at the hotel An example display showing functionality through testing is shown in Figure 1. Lab 06 Figure 1. Testing the functionality of the hotel object

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!