public void RunLogic4() { int logic4Number; string logic4String; long logic4Long; try { Console.WriteLine("Enter 'long' type number"); logic4Long = LongParser(); Console.WriteLine("Enter 'int' type number"); logic4Number = IntParser(); Console.WriteLine("Enter 'string' type message"); logic4String = StringParser(); Logics.Logic4(logic4String, logic4Number, logic4Long); } catch (ScubaException ex) { Console.WriteLine($"Sorry, student {ex.studentNumber}, You got a ScubaException: {ex.Message}"); } catch (NotImplementedException ex) { Console.WriteLine(ex.Message.ToString()); } }
public void RunLogic4() { string data1; int data2; long data3; try { Console.WriteLine("Enter 1 string : "); TryReadStringParser(out data1); try { Console.WriteLine("Enter int number"); TryReadIntParser(out data2); while (!long.TryParse(Console.ReadLine(), out data3)) { throw new ScubaException(String.Format("Enter Valid long"), StudentNum); } try { Logics.Logic4(data1, data2, data3); } catch (ScubaException se) { Console.WriteLine(se.Message.ToString() + se.StudentNum); throw; } } catch (ScubaException e) { Console.WriteLine(String.Format("Hey {0}, You have an exception as ScubaException : {1}", e.StudentNum, e.Message)); } Console.WriteLine("Enter 1 Long number: "); } catch (ScubaException e) { Console.WriteLine(String.Format("Hey {0}, You have an exception as ScubaException : {1}", e.StudentNum, e.Message)); } }