Exemplo n.º 1
0
 public string ValidateName(string name)
 {
     if (name.Length > 0 && name.Length < 15)
     {
         return(name);
     }
     _writer.Print(_messages.Error());
     return(ValidateName(_reader.Read()));
 }
Exemplo n.º 2
0
 public void Render(PaySlipInterface payslip, OutInterface output)
 {
     output.Print("Name: " + payslip.Name() + "\n");
     output.Print("Pay Period: " + payslip.PayPeriod() + "\n");
     output.Print("Gross Income: " + payslip.GrossIncome() + "\n");
     output.Print("Income Tax: " + payslip.Tax() + "\n");
     output.Print("Net Income: " + payslip.NetIncome() + "\n");
     output.Print("Super: " + payslip.Super() + "\n");
 }
 public void Render(PaySlipInterface payslip, OutInterface output)
 {
     output.Print("test");
 }
        public void Run(InputReaderInterface inputReader, InputValidatorInterface validator,
                        DisplayMessageInterface messages, OutInterface outputWriter, PayslipRendererInterface payslipRenderer)
        {
            outputWriter.Print(messages.Welcome());
            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.GetName());
            var firstName = validator.ValidateName(inputReader.Read());

            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.GetSurname());
            var surname = validator.ValidateName(inputReader.Read());

            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.GetSalary());
            var salary = validator.ValidateInteger(inputReader.Read());

            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.GetSuperRate());
            var super = validator.ValidateInteger(inputReader.Read());

            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.GetPaymentStartDate());
            var startDate = validator.ValidateDate(inputReader.Read());

            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.GetPaymentEndDate());
            var endDate = validator.ValidateDate(inputReader.Read());

            outputWriter.Print(messages.NewLine());

            var payslip = new PaySlip(firstName, surname, salary, super, startDate, endDate);

            payslipRenderer.Render(payslip, outputWriter);
            outputWriter.Print(messages.NewLine());

            outputWriter.Print(messages.ThankUser());
        }