Here is a program I've been working on. When it runs I get no errors, but it is still not doing quite what I need it to do. For the lines like "Console.WriteLine("{0} - Avg - {1} {2} {3} {4} {5} {6} {7} {8} {9} {10}", players[0], stats[0, 2, 0], stats[0, 2, 1], stats[0, 2, 2].ToString("P"), stats[0, 2, 3], stats[0, 2, 4], stats[0, 2, 5], stats[0, 2, 6], stats[0, 2, 7], stats[0, 2, 8], stats[0, 2, 9].ToString("P"));" I need it to write what runs in my method averge. Basically it is supposed to be the average of games 1 and 2. When I run the program though it still just gives me what I input last for the stat for each player. What am I missing?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Final
{
    class FinalProgram
    {
        public void average(double[, ,] MyVariable)
        {


            for (int x = 0; x <= 2; x++)
            {
                for (int z = 0; z <=9; z++)
                {
                    MyVariable[x, 2, z] = (MyVariable[x, 0, z] + MyVariable[x, 1, z]) / 2;

                }
            }

        }
        public static void Main()
        {

            double[, ,] stats = new double[3, 3, 10];
            string[] players = new string[3];
            int x, y;

            players[0] = "Tom Brady";
            players[1] = "Drew Brees";
            players[2] = "Peyton Manning";

            for (x = 0; x < 3; ++x)
            {
                Console.WriteLine("Enter stats for {0}", players[x]);
                for (y = 0; y < 2; ++y)
                {

                    Console.WriteLine("Game {0}", y + 1);
                    Console.WriteLine("Enter pass attempts: ");
                    stats[x, y, 0] = Convert.ToDouble(Console.ReadLine());
                    /*Console.WriteLine("Enter completions: ");    (Just saving from having to enter a ton of data while testing)
                    stats[x, y, 1] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter completion percentage: ");
                    stats[x, y, 2] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter total yards: ");
                    stats[x, y, 3] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter touchdowns: ");
                    stats[x, y, 4] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter interceptions: ");
                    stats[x, y, 5] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter rushing yards: ");
                    stats[x, y, 6] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter rushing touchdowns: ");
                    stats[x, y, 7] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter fumbles: ");
                    stats[x, y, 8] = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter QB rating: ");
                    stats[x, y, 9] = Convert.ToDouble(Console.ReadLine());*/
                }
            }

            FinalProgram app = new FinalProgram();
            app.average(stats);

            char letter = 'a';
            string input;
            {
                while (letter != 'q' || letter != 'Q')
                {
                    Console.Write("Enter the first letter of the first name of a player (T, D, P), enter 'A' for all players, or 'Q' to quit: ");
                    input = Console.ReadLine();
                    letter = Convert.ToChar(input);
                    if (letter == 'a' || letter == 'A')
                    {
                        Console.WriteLine("Player             Att   Comp  Comp %  PYards PTD INT RYards  RTD  F  QBR");
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("{0}  - Avg  - {1}    {2}     {3}      {4}    {5}   {6}   {7}     {8}   {9}  {10}", players[0], stats[0, 2, 0], stats[0, 2, 1], stats[0, 2, 2].ToString("P"), stats[0, 2, 3], stats[0, 2, 4], stats[0, 2, 5], stats[0, 2, 6], stats[0, 2, 7], stats[0, 2, 8], stats[0, 2, 9].ToString("P"));
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("{0}  - Avg  - {1}    {2}     {3}      {4}    {5}   {6}   {7}     {8}   {9}  {10}", players[1], stats[1, 2, 0], stats[1, 2, 1], stats[1, 2, 2].ToString("P"), stats[1, 2, 3], stats[1, 2, 4], stats[1, 2, 5], stats[1, 2, 6], stats[1, 2, 7], stats[1, 2, 8], stats[1, 2, 9].ToString("P"));
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("{0}- Avg- {1}    {2}     {3}      {4}    {5}   {6}   {7}     {8}   {9}  {10}", players[2], stats[2, 2, 0], stats[2, 2, 1], stats[2, 2, 2].ToString("P"), stats[2, 2, 3], stats[2, 2, 4], stats[2, 2, 5], stats[2, 2, 6], stats[2, 2, 7], stats[2, 2, 8], stats[2, 2, 9].ToString("P"));
                    }
                    else if (letter == 't' || letter == 'T')
                    {
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("Player             Att   Comp  Comp %  PYards PTD INT RYards  RTD  F  QBR");
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("{0}  - Avg  - {1}    {2}     {3}      {4}    {5}   {6}   {7}     {8}   {9}  {10}", players[0], stats[0, 1, 0], stats[0, 1, 1], stats[0, 1, 2].ToString("P"), stats[0, 1, 3], stats[0, 1, 4], stats[0, 1, 5], stats[0, 1, 6], stats[0, 1, 7], stats[0, 1, 8], stats[0, 1, 9].ToString("P"));
                    }
                    else if (letter == 'd' || letter == 'D')
                    {
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("Player             Att   Comp  Comp %  PYards PTD INT RYards  RTD  F  QBR");
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("{0}  - Avg  - {1}    {2}     {3}      {4}    {5}   {6}   {7}     {8}   {9}  {10}", players[1], stats[1, 1, 0], stats[1, 1, 1], stats[1, 1, 2].ToString("P"), stats[1, 1, 3], stats[1, 1, 4], stats[1, 1, 5], stats[1, 1, 6], stats[1, 1, 7], stats[1, 1, 8], stats[1, 1, 9].ToString("P"));
                    }
                    else if (letter == 'p' || letter == 'P')
                    {
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("Player             Att   Comp  Comp %  PYards PTD INT RYards  RTD  F  QBR");
                        Console.WriteLine("\n----------------------------------------------------------------------------");
                        Console.WriteLine("{0}- Avg- {1}    {2}     {3}      {4}    {5}   {6}   {7}     {8}   {9}  {10}", players[2], stats[2, 1, 0], stats[2, 1, 1], stats[2, 1, 2].ToString("P"), stats[2, 1, 3], stats[2, 1, 4], stats[2, 1, 5], stats[2, 1, 6], stats[2, 1, 7], stats[2, 1, 8], stats[2, 1, 9].ToString("P"));
                    }
                    else
                    {
                        Console.WriteLine("Sorry, not a valid initial.");
                        Console.Write("Enter next players initial or 'Q' to quit ");
                        input = Console.ReadLine();
                        letter = Convert.ToChar(input);
                    }

                }
            }

        }

    }
}

I'm an idiot

If you already solved it, please post here the solution for others to learn., and mark as solved.

Tx in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.