酒店管理
一家著名的酒店在迈阿密拥有三个分店。即x,y和z(实际上他们给了名字)。每个人都有两种类型的客户。定期和受奖者。此外,每个分支都有自己的评级,x 获得 3 星评级,y 获得 5 星评级,z 获得 4 星评级。
每家酒店都有周末和工作日的具体价格。x 平日对普通客户收取 100 美元,周末收取 120 美元,而平日对受奖者收取 90 美元,周末收取 60 美元。同样,y 平日向常客收取 130 美元,周末收取 150 美元。平日为 100 美元,周末为 95 美元。而 z 在工作日对普通客户收取 195 美元,在周末收取 150 美元。平日为 120 美元,周末为 90 美元。现在,当客户要求特定细节时,您需要找到哪家酒店会为客户带来利润。如果酒店之间出现平局,请比较评级并提供结果。
输入格式:
常规:2010 年 3 月 16 日(周日)、2010 年 3 月 19 日(周三)、2010 年 3 月 21 日(周五)
我已经制作了这段代码......请告诉我我是否朝着正确的方向前进。还有我怎样才能使酒店价格动态
getTheday = function(aText,typeofcustomer)
{
this.typeofcustomer = typeofcustomer;
myDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
if(new Date(aText).getDay() == 0 || new Date(aText).getDay() == 5 || new Date(aText).getDay() == 6)
{
console.log("its weekend!!!");
this.weekend(this.typeofcustomer);
}
console.log("it is ", myDays[new Date(aText).getDay()]);
}
getTheday.prototype.weekend = function(typeofcustomer)
{
console.log(typeofcustomer);
this.hoteloptionsforweekend();
}
getTheday.prototype.hoteloptionsforweekend = function()
{
if(this.typeofcustomer == "rewardee")
{
this.hotelpricex_ = 60;
this.hotelpricey_ = 95;
this.hotelpricez_ = 90;
this.minhotelprice = Math.min(this.hotelpricex_, this.hotelpricey_, this.hotelpricez_)
console.log("min price is of hotel", this.minhotelprice);
}
if(this.typeofcustomer == "regular")
{
this.hotelpricex_ = 120;
this.hotelpricey_ = 150;
this.hotelpricez_ = 150;
}
}