Ejemplo n.º 1
0
        private static async Task Div()
        {
            Console.Clear();

            var dividend = PromptSelection("Enter the dividend, or 'X' to end:");

            if (dividend is null)
            {
                AnsiConsole.MarkupLine($"There is no dividend, no operation performed\n");
                return;
            }

            var divisor = PromptSelection("Enter the divisor, or 'X' to end:");

            if (dividend is null)
            {
                AnsiConsole.MarkupLine($"There is no divisor, no operation performed\n");
                return;
            }

            var divRequest = new DivRequest {
                Dividend = dividend.Value, Divisor = divisor.Value
            };
            var response = await CalculatorServiceClient.DivAsync(divRequest);

            AnsiConsole.MarkupLine($"The quotient is: {response.Quotient} and the remainder is {response.Remainder}\n");
        }