Advertisement
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;
- using System.Speech.Synthesis;
- namespace ЛицаНаФигури
- {
- class Program
- {
- static void Main(string[] args)
- {
- string square;
- string rectangle;
- string circle;
- string triangle;
- double area;
- Console.ForegroundColor = ConsoleColor.Magenta;
- SpeechSynthesizer synth = new SpeechSynthesizer();
- synth.Speak("Welcome to Iskren Mirev program version one point O");
- synth.Speak("This is the personal calculator of SoftUni");
- while (true)
- {
- Console.ForegroundColor = ConsoleColor.Magenta;
- Console.WriteLine("Please type figure to calculate the area: ");
- Console.Write("Example (square , rectangle , circle , triangle) : ");
- synth.Speak("Please type figure to calculate the area " +
- "Example (square , rectangle , circle , triangle)");
- string user = Console.ReadLine();
- if (user == "square")
- {
- Console.Write("Pleace enter lenght: ");
- synth.Speak("Pleace enter lenght");
- double a1 = double.Parse(Console.ReadLine());
- area = Math.Round((a1 * a1), 3);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("area: " + area);
- string a = string.Format("The area of the square is {0}", area);
- synth.Speak(a);
- }
- else if (user == "rectangle")
- {
- Console.Write("Pleace enter lenght A: ");
- synth.Speak("Pleace enter lenght A");
- double a1 = double.Parse(Console.ReadLine());
- Console.Write("Pleace enter lenght B: ");
- synth.Speak("Pleace enter lenght B");
- double a2 = double.Parse(Console.ReadLine());
- area = Math.Round((a1 * a2), 3);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("area: " + area);
- string b = string.Format("The area of the rectangle is {0}", area);
- synth.Speak(b);
- }
- else if (user == "circle")
- {
- Console.Write("Pleace enter radius: ");
- synth.Speak("Pleace enter radius");
- double a1 = double.Parse(Console.ReadLine());
- area = Math.Round(((a1 * a1) * Math.PI), 3);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("area: " + area);
- string c = string.Format("The area of the circle is {0}", area);
- synth.Speak(c);
- }
- else if (user == "triangle")
- {
- Console.Write("Pleace enter lenght: ");
- synth.Speak("Pleace enter lenght");
- double a1 = double.Parse(Console.ReadLine());
- Console.Write("Pleace enter the length of the height: ");
- synth.Speak("Pleace enter the length of the height");
- double a2 = double.Parse(Console.ReadLine());
- area = Math.Round(((a1 * a2) / 2.0), 3);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("area: " + area);
- string d = string.Format("The area of the triangle is {0}", area);
- synth.Speak(d);
- }
- synth.Speak("Iskren Mirev wishes you a pleasant day");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement