Question
Using C#, implement a method GetMax() with two integer (int) parameters, that returns maximal of the two numbers. Write a program that reads three numbers
Using C#, implement a method GetMax() with two integer (int) parameters, that returns maximal of the two numbers. Write a program that reads three numbers from the console and prints the biggest of them. Use the GetMax() method you just implemented. Write a test program that validates that the methods works correctly. Guideline: Use the expression Max(a, b, c) = Max(Max(a, b), c). To test the code check whether the results from the invoked methods is correct for a set of examples that cover the most interesting cases, e.g. Max(1,2)=2; Max(3,-1)=3; Max(-1,-1)=-1; Max(1,2,444444)=444444; Max(5,2,1)=5; Max(-1,6,5)=6; Max(0,0,0)=0; Max(-10,-10,-10)=-10; Max(2000000000,-2000000001,2000000002)=2000000002; etc. You may write a generic method that works not just for int but for any other type T using the following declaration: static T Max
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started