Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. while (true)
  13. {
  14.  
  15. try
  16. {
  17. Console.ForegroundColor = ConsoleColor.White;
  18. Console.WriteLine("Welcome to Grand Circus' Room Detail Generator");
  19. Console.WriteLine();
  20. Console.WriteLine("Enter Length:");
  21. string length = Console.ReadLine();
  22. double lengthint = double.Parse(length);
  23. Console.WriteLine();
  24. Console.WriteLine("Enter Width");
  25. string Width = Console.ReadLine();
  26. double Widthint = double.Parse(Width);
  27. Console.WriteLine();
  28. Console.WriteLine("Area");
  29. double Area = lengthint * Widthint;
  30. Console.WriteLine(Area);
  31. Console.WriteLine();
  32. Console.WriteLine("Perimeter");
  33. double Perimeter = 2 * (lengthint + Widthint);
  34. Console.WriteLine(Perimeter);
  35. string answer = null;
  36. while (answer != "YES" | answer != "NO")
  37. {
  38. Console.WriteLine("Run again [Yes][No]?");
  39. answer = Console.ReadLine().ToUpper();
  40. if (answer == "NO")
  41. return;
  42. if (answer == "YES")
  43. {
  44. Console.Clear();
  45. break;
  46. }
  47. }
  48.  
  49. }
  50. catch (Exception ex)
  51. {
  52. Console.ForegroundColor = ConsoleColor.Red;
  53. Console.WriteLine(string.Format("ERROR: {0}", ex.Message));
  54. Console.ForegroundColor = ConsoleColor.White;
  55. }
  56. }
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement