Question: Write a console application to ask for a name, two numbers, and a math symbol and produce the results as follows: Enter your name: Mike

 Write a console application to ask for a name, two numbers,
and a math symbol and produce the results as follows: Enter your

Write a console application to ask for a name, two numbers, and a math symbol and produce the results as follows: Enter your name: Mike (** This could be any name.**) Enter x: 8 Enter y: 4 Enter a symbol +, - 5.7:/ (** This could be one of the four symbols. **) 8/4=2 8/4 = 2 Thanks for using our program, Mikell (** Whatever name you entered at the beginning. **) Requirements 1. The name and all the values above are only examples. 2. Declare four variables (ie, name, x, y, and result). 3. Declare x as an integer and y as a double (or vice versa). 4. If the entered symbol is either +, -, or, then display the result appropriately. Otherwise, do not display the result but simply display an error message e.g. "Invalid input". Use if else. 5. Use placeholders ( to display the first line of the result. 6. Use string concatenation (+) to display the second line of the result. How to submit 1. Write your full name and Q# as a comment at the top of your source file (e.g. program.cs). To locate the source file, right-click at the tab of the source file in Visual Studio hnd click "Open Containing Folder." Quiz2.2.csi. Que Save Qu.2.2.cs Close Close Al But This Copy Ful Path Open Containing Folder 2. Submit the cs file on Blackboard. Be sure that it is the CS file. (NOT a project or solution file). Otherwise, your grade will be a zero. Press to such ut down correctly. Will you take a minute to tell us more about what happened? Send Fe ake a quick survey to let us know how we're doing. G Give Feedback Not Now Don't Sho Q Find int x; Program.cs Program Main(string args) 4 5 class Program ma No Results 6 { 7 static void Main(string[] args) 8 9 { 1e string name; 11 12 double yo 13 double result; 14 15 Console.Write("Enter your name:"); 16 name = Console.ReadLine(); 17 18 Console.Write("Enter x:"); 19 X = Convert.ToInt32(Console.ReadLine(); 20 Console.Write("Enter y:"); 21 y = Convert.ToDouble(Console.ReadLine(); 22 23 Console.WriteLine("Here are the results:"); 24 25 result = x + y; 26 Console.Write("The result of {0} + {1} is: {2}", x, y, result); 27 Console.Write("The result of (O) - {0} is: {0}", x, y, result); 28 Console.Write("The result of {1} + {@) is: {2}", x, y, result); 29 Console.Write("The result of {@} + (1) is: (1)", X, Y, result); 30 //the following is not going to work 31 //Console.Write("The result of {0} + {1} is: {3}", x, y, result); 32 33 result = x - y: 34 Console.Write("{x) {y} is: {result}"); 35 36 result = X * Y: 37 Console.Write(" The result of " + x + y + is: + result); 38 39 40 result = x/y; 41 Console.Write(x + " + " divided by is: ut result.in 42 43 44 Console.WriteLine("Thanks for using our program, " + name + "!!!"); 45 46 47 48

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!