I have been working on this all day can someone please tell me what I am doing wrong.
using System;
public class ArrayManagement
{
public static void Main(string[] args)
{
int[] myArray;
myArray = new int[7];
myArray = fillArray();
int sum, avg;
arrayMath(myArray, out sum, out avg);
displayArray(myArray);
}
public static void arrayMath(int[] myArray, out int sum, out int avg)
{
sum = myArray.Sum();
avg = myArray.Average();
}
public static void displayArray(int[] myArray)
{
Console.Write("Your sum and average is: ");
for (int i = 0; i < 8; i++)
Console.Write(myArray[i] + " ");
Console.WriteLine();
}
public static int[] fillArray()
{
int[] myArray;
myArray = new int[7];
int count = 0;
do
{
Console.Write("Please enter a number to add to the array or \"x\" to stop: ");
string consoleInput = Console.ReadLine();
if (consoleInput == "x")
{
return myArray;
}
else
{
myArray[count] = Convert.ToInt32(consoleInput);
++count;
}
} while (count < 8);
return myArray;
}
}