Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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)

Step by Step Solution

3.44 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

Solution using System using SystemCollectionsGeneric using SystemLinq using SystemText using SystemT... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Physics

Authors: Paul G. Hewitt

11th edition

321568095, 9780-032166256, 321662563, 978-0321568090

More Books

Students also viewed these Accounting questions