Answer to Question #315128 in C# for Saphira

Question #315128

Write a console application that uses at least five different method of math class. Provide a meaningful identifier of the variables are constant. Name the namespace as mathApp and it's class as mathProgram.

1
Expert's answer
2022-03-21T12:36:03-0400
using System;


namespace mathApp
{
    class mathProgram
    {
        public delegate double PerformCalculation(double _input);

        static PerformCalculation _pc;

        static void Main(string[] args)
        {
            string pick = Console.ReadLine();

            switch (pick)
            {
                case "Abs":
                    _pc = Math.Abs;
                    break;
                case "Sin":
                    _pc = Math.Sin;
                    break;
                case "Cos":
                    _pc = Math.Cos;
                    break;
                case "Log":
                    _pc = Math.Log;
                    break;
                case "L10":
                    _pc = Math.Log10;
                    break;
                default:
                    return;
            }
            double _input = Convert.ToDouble(Console.ReadLine());
            double output =  _pc(_input);
            Console.WriteLine(output);
            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS