C# Language Write a Console App to compute average of three numbers for four different numeric data
Fantastic news! We've Found the answer you've been seeking!
Question:
C# Language
Write a Console App to compute average of three numbers for four different numeric data types float, decimal, int and double. You will need to write four separate methods.
For each of the four methods:
- Name your method Average()
- Determine the return type for the method (HINT: It might be different that data type you are averaging)
- Include the argument list with 3 numbers as parameters
- Compute the average of the three
- Avoid Magic Numbers!
- Return the average
- Add a comment in the method body to explain the return type you selected
In the Main() method
- Declare 3 variable of each type following naming conventions (DO NOT ASK FOR USER INPUT)
- Declare 4 variables to store the result of each average following naming conventions
- Make a method call to each Average() for the 4 data types, storing the result in the corresponding variable
- Print the results for each (with enough information for the user to understand the output)
Related Book For
Posted Date: