Write a program C# named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. For example, if 7 and 4 were passed to the method, the output would be: 7 4 -- Average is 5.5 Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers. using static System.Console; public class Averages {    public static void Main()    {       // Write your main here    } }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 7E
icon
Related questions
Question

Write a program C# named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average.

For example, if 7 and 4 were passed to the method, the output would be:

7 4 -- Average is 5.5

Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers.

using static System.Console;
public class Averages
{
   public static void Main()
   {
      // Write your main here
   }

}
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Hello,the code does work but it seems there is an error with the system i am using.                                                                                                                            

Unit Test incomplete
Method Average can average two numbers
Build Status
Build Succeeded
Test Output Ⓡ
NUnit Console Runner 3.10.0 (.NET 2.0)
Copyright (c) 2019 Charlie Poole, Rob Prouse
Wednesday, 15 March 2023 17:35:11
Runtime Environment
OS Version: Linux 5.0.0.27
CLR Version: 4.0.30319.42000
Test Files
Nt Testbacb4ceb.dll
Errors, Failures and Warnings
1) Failed Average TwoNumbers Test. Average Test
Expected the average of 8 and 10 to be 9
Expected string length 21 but was 20. Strings differ at index 5.
Expected: "8 10 -- Average is 9"
But was: "8 10
Average is 9"
at Average TwoNumbers Test. Average Test () [0x00000] in <e7325ba8777f492e818639c
Run Settings
DisposeRunners: True.
WorkDirectory: /root/sandboxfe029a55
ImageRuntimeVersion: 4.0.30319
ImageRequiresX86: False
ImageRequires Default AppDomainAssemblyResolver: False
Number Of TestWorkers: 2
Test Run Summary
Overall result: Failed
Test Count: 1, Passed: 0, Failed: 1, Warnings: 0, Inconclusive: 0, Skipped: 0
Failed Tests - Failures: 1, Errors: 0, Invalid: 0
Start time: 2023-03-15 17:35:11Z
End time: 2023-03-15 17:35:13Z
Duration: 1.392 seconds
Transcribed Image Text:Unit Test incomplete Method Average can average two numbers Build Status Build Succeeded Test Output Ⓡ NUnit Console Runner 3.10.0 (.NET 2.0) Copyright (c) 2019 Charlie Poole, Rob Prouse Wednesday, 15 March 2023 17:35:11 Runtime Environment OS Version: Linux 5.0.0.27 CLR Version: 4.0.30319.42000 Test Files Nt Testbacb4ceb.dll Errors, Failures and Warnings 1) Failed Average TwoNumbers Test. Average Test Expected the average of 8 and 10 to be 9 Expected string length 21 but was 20. Strings differ at index 5. Expected: "8 10 -- Average is 9" But was: "8 10 Average is 9" at Average TwoNumbers Test. Average Test () [0x00000] in <e7325ba8777f492e818639c Run Settings DisposeRunners: True. WorkDirectory: /root/sandboxfe029a55 ImageRuntimeVersion: 4.0.30319 ImageRequiresX86: False ImageRequires Default AppDomainAssemblyResolver: False Number Of TestWorkers: 2 Test Run Summary Overall result: Failed Test Count: 1, Passed: 0, Failed: 1, Warnings: 0, Inconclusive: 0, Skipped: 0 Failed Tests - Failures: 1, Errors: 0, Invalid: 0 Start time: 2023-03-15 17:35:11Z End time: 2023-03-15 17:35:13Z Duration: 1.392 seconds
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage