public HotelType FindCheapestHotel(string startDate, string endDate, CustomerType type) { Hotel LakeWood = new Hotel(HotelType.LAKEWOOD, type); Hotel BridgeWood = new Hotel(HotelType.BRIDGEWOOD, type); Hotel RidgeWood = new Hotel(HotelType.RIDGEWOOD, type); //Calculating Rate of Each Hotel Between the given dates double LakeWoodRate = LakeWood.FindTotalCost(startDate, endDate); double BridgeWoodRate = BridgeWood.FindTotalCost(startDate, endDate); double RidgeWoodRate = RidgeWood.FindTotalCost(startDate, endDate); double MinRate = Math.Min(LakeWoodRate, Math.Min(BridgeWoodRate, RidgeWoodRate)); if (MinRate == LakeWoodRate && MinRate == BridgeWoodRate && MinRate == RidgeWoodRate) { return(HotelType.RIDGEWOOD); } if (MinRate == LakeWoodRate && MinRate == BridgeWoodRate) { return(HotelType.BRIDGEWOOD); } if (MinRate == BridgeWoodRate && MinRate == RidgeWoodRate) { return(HotelType.RIDGEWOOD); } if (MinRate == LakeWoodRate && MinRate == BridgeWoodRate) { return(HotelType.RIDGEWOOD); } if (MinRate == LakeWoodRate) { return(HotelType.LAKEWOOD); } if (MinRate == BridgeWoodRate) { return(HotelType.BRIDGEWOOD); } return(HotelType.RIDGEWOOD); }
public HotelType FindCheapestHotel(string startDate, string endDate) { Hotel LakeWood = new Hotel(HotelType.LAKEWOOD); Hotel BridgeWood = new Hotel(HotelType.BRIDGEWOOD); Hotel RidgeWood = new Hotel(HotelType.RIDGEWOOD); double LakeWoodRate = LakeWood.FindTotalCost(startDate, endDate); double BridgeWoodRate = BridgeWood.FindTotalCost(startDate, endDate); double RidgeWoodRate = RidgeWood.FindTotalCost(startDate, endDate); if (LakeWoodRate < BridgeWoodRate && LakeWoodRate < RidgeWoodRate) { return(HotelType.LAKEWOOD); } else if (BridgeWoodRate < LakeWoodRate && BridgeWoodRate < RidgeWoodRate) { return(HotelType.BRIDGEWOOD); } else { return(HotelType.RIDGEWOOD); } }
public HotelTypes FindCheapestHotel(string startDate, string endDate, CustomerType type) { Hotel LakeWood = new Hotel(HotelTypes.LAKEWOOD, type); Hotel BridgeWood = new Hotel(HotelTypes.BRIDGEWOOD, type); Hotel RidgeWood = new Hotel(HotelTypes.RIDGEWOOD, type); double LakeWoodRate = LakeWood.FindTotalCost(startDate, endDate); double BridgeWoodRate = BridgeWood.FindTotalCost(startDate, endDate); double RidgeWoodRate = RidgeWood.FindTotalCost(startDate, endDate); double MinRate = Math.Min(LakeWoodRate, Math.Min(BridgeWoodRate, RidgeWoodRate)); if (MinRate == LakeWoodRate && MinRate == BridgeWoodRate && MinRate == RidgeWoodRate) { return(HotelTypes.RIDGEWOOD); } if (MinRate == LakeWoodRate && MinRate == BridgeWoodRate) { return(HotelTypes.BRIDGEWOOD); } if (MinRate == BridgeWoodRate && MinRate == RidgeWoodRate) { return(HotelTypes.RIDGEWOOD); } if (MinRate == LakeWoodRate && MinRate == BridgeWoodRate) { return(HotelTypes.RIDGEWOOD); } if (MinRate == LakeWoodRate) { return(HotelTypes.LAKEWOOD); } if (MinRate == BridgeWoodRate) { return(HotelTypes.BRIDGEWOOD); } return(HotelTypes.RIDGEWOOD); }