Advertisement
Iskrenov84

ЛицаНаФигури-FUN

Jan 29th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Speech.Synthesis;
  7. namespace ЛицаНаФигури
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. string square;
  15. string rectangle;
  16. string circle;
  17. string triangle;
  18. double area;
  19.  
  20. Console.ForegroundColor = ConsoleColor.Magenta;
  21. SpeechSynthesizer synth = new SpeechSynthesizer();
  22. synth.Speak("Welcome to Iskren Mirev program version one point O");
  23. synth.Speak("This is the personal calculator of SoftUni");
  24.  
  25.  
  26. while (true)
  27. {
  28. Console.ForegroundColor = ConsoleColor.Magenta;
  29. Console.WriteLine("Please type figure to calculate the area: ");
  30. Console.Write("Example (square , rectangle , circle , triangle) : ");
  31. synth.Speak("Please type figure to calculate the area " +
  32. "Example (square , rectangle , circle , triangle)");
  33. string user = Console.ReadLine();
  34.  
  35.  
  36. if (user == "square")
  37. {
  38. Console.Write("Pleace enter lenght: ");
  39. synth.Speak("Pleace enter lenght");
  40. double a1 = double.Parse(Console.ReadLine());
  41. area = Math.Round((a1 * a1), 3);
  42. Console.ForegroundColor = ConsoleColor.Green;
  43. Console.WriteLine("area: " + area);
  44. string a = string.Format("The area of the square is {0}", area);
  45. synth.Speak(a);
  46. }
  47. else if (user == "rectangle")
  48. {
  49. Console.Write("Pleace enter lenght A: ");
  50. synth.Speak("Pleace enter lenght A");
  51. double a1 = double.Parse(Console.ReadLine());
  52. Console.Write("Pleace enter lenght B: ");
  53. synth.Speak("Pleace enter lenght B");
  54. double a2 = double.Parse(Console.ReadLine());
  55. area = Math.Round((a1 * a2), 3);
  56. Console.ForegroundColor = ConsoleColor.Green;
  57. Console.WriteLine("area: " + area);
  58. string b = string.Format("The area of the rectangle is {0}", area);
  59. synth.Speak(b);
  60. }
  61. else if (user == "circle")
  62. {
  63. Console.Write("Pleace enter radius: ");
  64. synth.Speak("Pleace enter radius");
  65. double a1 = double.Parse(Console.ReadLine());
  66. area = Math.Round(((a1 * a1) * Math.PI), 3);
  67. Console.ForegroundColor = ConsoleColor.Green;
  68. Console.WriteLine("area: " + area);
  69. string c = string.Format("The area of the circle is {0}", area);
  70. synth.Speak(c);
  71. }
  72. else if (user == "triangle")
  73. {
  74. Console.Write("Pleace enter lenght: ");
  75. synth.Speak("Pleace enter lenght");
  76. double a1 = double.Parse(Console.ReadLine());
  77. Console.Write("Pleace enter the length of the height: ");
  78. synth.Speak("Pleace enter the length of the height");
  79. double a2 = double.Parse(Console.ReadLine());
  80. area = Math.Round(((a1 * a2) / 2.0), 3);
  81. Console.ForegroundColor = ConsoleColor.Green;
  82. Console.WriteLine("area: " + area);
  83. string d = string.Format("The area of the triangle is {0}", area);
  84. synth.Speak(d);
  85. }
  86. synth.Speak("Iskren Mirev wishes you a pleasant day");
  87. }
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement