/// <summary> /// Ask user for which gate to be used /// </summary> /// <param name="hill"></param> /// <param name="type"> clarification (is this the startup gate or gate change) </param> /// <returns> gate number </returns> public static int SelectGate(Hill hill, string type) { while (true) { Console.Write("Select {0} gate ({1}..{2}, current {3}) : ", type, hill.LowestGate, hill.HighestGate, hill.CurrGate); try { var gate = int.Parse(Console.ReadLine()); if (gate >= hill.LowestGate && gate <= hill.HighestGate) { return(gate); } } catch (Exception ex) { // } } }
private Hill _hill; // reference to the hill /// <summary> /// constructor /// </summary> /// <param name="hill"> reference to the hill object </param> public Compensation(Hill hill) { Hill = hill; }