Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _06_Notification
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string result = Console.ReadLine();
- if (result=="succes")
- {
- string operation = Console.ReadLine();
- string message = Console.ReadLine();
- ShowSuccess(operation, message);
- }
- else if (result == "error")
- {
- string operation1 = Console.ReadLine();
- int code = int.Parse(Console.ReadLine());
- ShowError(operation1, code);
- }
- }
- }
- static void ShowSuccess(string operation, string message)
- {
- var result = $"Successfully executed {operation}." + Environment.NewLine;
- result += "==============================" + Environment.NewLine;
- result += $"Message: {message}.";
- Console.WriteLine(result);
- }
- static void ShowError(string operation1, int code)
- {
- var result = $"Error: Failed to execute {operation1}." + Environment.NewLine;
- result += "==============================" + Environment.NewLine;
- result += $"Error Code: {code}." + Environment.NewLine;
- string reason = String.Empty;
- if (code >= 0)
- {
- reason = "Invalid Client Data";
- }
- else
- {
- reason = "Internal System Failure";
- }
- result += $"Reason: {reason}.";
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment