static void Main(string[] args) { if (args == null || args.Length != 3) { PrintUsage(); return; } String fee = ""; try{ string CountryCode = args[0]; DateTime DateStart = Convert.ToDateTime(args[1]); DateTime DateEnd = Convert.ToDateTime(args[2]); int result = DateTime.Compare(DateStart, DateEnd); if (result > 0) { throw new Exception("The end date is less than start date."); } fee = new PenaltyFeeCalculator().Calculate(CountryCode, DateStart, DateEnd); /* Description, * please implement PenaltyFeeCalculator class * feel free to make any changes (if necessary) * to PenaltyFeeCalculator class method and constructor signatures, * as well as here this very portion of the main method * You should not need to change any other methods in this class. */ } catch (Exception e) { PrintErrorMessage(e); } PrintResultMessage(fee); }
static void Main(string[] args) { if (args == null || args.Length != 3) { PrintUsage(); return; } String fee = ""; try{ /* Description, * please implement PenaltyFeeCalculator class * feel free to make any changes (if necessary) * to PenaltyFeeCalculator class method and constructor signatures, * as well as here this very portion of the main method * You should not need to change any other methods in this class. */ fee = new PenaltyFeeCalculator(args[0], DateTime.Parse(args[1]), DateTime.Parse(args[2])).Calculate(); //Burada yaptýðým tek ekleme yukarýdaki parametreleri göndermek oldu. } catch (Exception e) { PrintErrorMessage(e); } PrintResultMessage(fee); }
static void Main(string[] args) { if (args == null || args.Length != 3) { PrintUsage(); return; } String fee = ""; try{ var result = PrintUsage(); fee = new PenaltyFeeCalculator().Calculate(Convert.ToDateTime(result[1]), Convert.ToDateTime(result[2]), result[0]); } catch (Exception e) { PrintErrorMessage(e); } PrintResultMessage(fee); }
static void Main(string[] args) { if (args == null || args.Length != 3) { PrintUsage(); return; } String fee = ""; try { string countryCode = ""; DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now; Console.WriteLine("CountryCode gir: "); countryCode = Console.ReadLine(); Console.WriteLine("startDate gir: "); startDate = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("endDate gir: "); endDate = Convert.ToDateTime(Console.ReadLine()); /* Description, * please implement PenaltyFeeCalculator class * feel free to make any changes (if necessary) * to PenaltyFeeCalculator class method and constructor signatures, * as well as here this very portion of the main method * You should not need to change any other methods in this class. */ fee = new PenaltyFeeCalculator().Calculate(countryCode, startDate, endDate); } catch (Exception e) { PrintErrorMessage(e); } PrintResultMessage(fee); }
static void Main(string[] args) { if (args == null || args.Length != 3) { PrintUsage(); return; } String fee = ""; try{ /* Description, * please implement PenaltyFeeCalculator class * feel free to make any changes (if necessary) * to PenaltyFeeCalculator class method and constructor signatures, * as well as here this very portion of the main method * You should not need to change any other methods in this class. */ fee = new PenaltyFeeCalculator().Calculate(); } catch (Exception e) { PrintErrorMessage(e); } PrintResultMessage(fee); }