Question: Hi can you help me in these method ? java eclipse Hotel class package donottouch; import java.util.ArrayList; public class Hotel { private String name; private

Hi

can you help me in these method ? java eclipse

Hotel class

package donottouch;

import java.util.ArrayList;

public class Hotel {

private String name; private int numberOfFloors; private ArrayList rooms; public Hotel(String name, int numberOfFloors) { this.name = name; this.numberOfFloors = numberOfFloors; rooms = new ArrayList(); } public String getName() { return name; } public int getNumberOfFloors() { return numberOfFloors; } public Room getRoomAt(int index) { return rooms.get(index); } public void addRoom(Room room) { rooms.add(room); } public int getNumOfRooms() { return rooms.size(); } public String toString() { String ans = String.format("Name: %s, Number of floors: %d%n", name, numberOfFloors); for (Room r : rooms) ans += String.format("%s%n", r.toString()); return ans; } }

---------------------------------------------------------------------------------------------------------------------------------------------------

package donottouch;

public class DoubleRoom extends Room implements Wifi{

private int numberOfBeds; private String wifiName; private String wifiPass; private boolean hasWifi; private int wifiEncryption; public DoubleRoom(int floorNum, boolean beachView, int numberOfBeds, boolean hasWifi) { super(floorNum, beachView); this.numberOfBeds = numberOfBeds; this.hasWifi = hasWifi; } public int getNumberOfBeds() { return numberOfBeds; }

@Override public String getWifiName() { return wifiName; }

@Override public String getWifiPass() { return wifiPass; }

@Override public boolean hasWifi() { return hasWifi; }

@Override public void setWifiName(String name) { wifiName = name; }

@Override public void setWifiPass(String pass) { wifiPass = pass; }

@Override public int getWifiEncryption() { return wifiEncryption; }

@Override public void setWifiEncryption(int encrypt) { wifiEncryption = encrypt; } public String toString() { String ans = "Type: Double, Floor number: " + getFloorNumber() + ", Beach view: " + hasBeachView() + ", Number of beds: " + numberOfBeds + ", Has wifi: " + hasWifi; if (hasWifi) ans += ", Wifi name: " + wifiName + ", Wifi pass: " + wifiPass + ", Wifi Encryption: " + ((wifiEncryption == Wifi.WPA_ENCRYPTION)? "WPA" : "WPA2"); return ans; }

}

 Hi can you help me in these method ? java eclipse

public static int getNumberofDoubleRooms (Hotel hotel) {//T0D0 2: make this method return the number of Double rooms inside a given hotel return -1;//replace this } public static Hotel getSingleOnly Hotel (Hotel hotel) {//TODO 3: make this method return a new hotel with the same name, and number of floors as the given hotel.//However, the new hotel should ONLY contain the single rooms (no double rooms).//return null.//replace this } public static Wifi getNewRoomWithWifi() {//TODO 4: make this method return a new room with the following Wifi details://(You may fill the other details with your own random information)/* * *Wifi name: Netgear. *Wifi pass: abcdefg *Wifi encryption: WPA */

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!