static void Main(string[] args) { ExpenseHandler william = new ExpenseHandler(new Employee("William Worker", Decimal.Zero)); ExpenseHandler mary = new ExpenseHandler(new Employee("Mary Manager", new Decimal(1000))); ExpenseHandler victor = new ExpenseHandler(new Employee("Victor Vicepres", new Decimal(5000))); ExpenseHandler paula = new ExpenseHandler(new Employee("Paula President", new Decimal(20000))); william.RegisterNext(mary); mary.RegisterNext(victor); victor.RegisterNext(paula); Decimal expenseReportAmount; if (ConsoleInput.TryReadDecimal("Expense report amount:", out expenseReportAmount)) { IExpenseReport expense = new ExpenseReport(expenseReportAmount); ApprovalResponse response = william.Approve(expense); WriteLine($"The request was {response}."); ReadLine(); } }
static void Main(string[] args) { ExpenseHandler William = new ExpenseHandler(new Employee("William Worker", Decimal.Zero)); ExpenseHandler Mary = new ExpenseHandler(new Employee("Mary Manager", new decimal(1000))); ExpenseHandler Victor = new ExpenseHandler(new Employee("Victor Vicepres", new decimal(5000))); ExpenseHandler Paula = new ExpenseHandler(new Employee("Paula Pres", new decimal(20000))); William.RegisterNext(Mary); Mary.RegisterNext(Victor); Victor.RegisterNext(Paula); Decimal expenseReportAmount; do { Console.Write("Expense Report Amout: "); Decimal.TryParse(Console.ReadLine(), out expenseReportAmount); IExpenseReport expense = new ExpenseReport(expenseReportAmount); ApprovalResponse response = William.Approve(expense); Console.WriteLine($"The request was {response}"); Console.WriteLine("Again? "); } while (Console.ReadLine() != ""); }