The tiny tots tee-ball league has 12 players who have jersey numbers 0 through 11. The coach wants a program into which he can type a player’s number and the number of bases the player got in a turn at bat (a number 0 through 4). Write a program that allows the coach to continually enter the values until 999 is entered. Store the statistics in a two dimensional array. At the end of a data entry session, display each player’s number and the number of 0-bases, 1-base, 2-base, and 3-base, and 4-base turns the player had. Display a separate count of the number of data-entry errors the coach makes (a player number greater than 11 or a number of bases greater than 4).

try it out on a paper first u need an if statement to test if 999 is entered you need an array to stare the info and a forlooop to display them... doubt anyone will write your homework code for you

First make an int array that has 12 rows (jersies 0-11) and 5 columns (5 bases). See this article how to declare tw-dimensional arrays. Then you need to create two loops, one inside the other. The outer loop is for each of the 12 jersies, while the inner loop allows someone to enter the data for esch of the bases.

Take the problem in small steps, don't attempt to write it all at one time. Write some code, compile, fix errors, then write some more code. Repeat those steps until the program is finished.

Hello,
Quick take a look at the code that I have composed, but I'm still having an error on it, could you explain
what is missing?.

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

namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
//int count = 0, inputString,
int bbase= 0, playerNo = 0, x = 0;
int baseZero = 0, baseOne = 0, baseTwo = 0, baseThree = 0, baseFour = 0;
//string[,] Players = new string[3, 5];

int[,] Players = new int[3, 5];
for ( x = 0; x < 3; x++)
{

Console.Write("Enter player number ", x + 1);

while (playerNo != 999)
{

Console.Write("Enter the bases", x + 1);

if (bbase >= 5)
{
Console.WriteLine("***Error in number of bases:  " + bbase + " " + "is too high");

}

baseZero = 0 * bbase;
baseOne = 1 * bbase;
baseTwo = 2 * bbase;
baseThree = 3 * bbase;
baseFour = 4 * bbase;

if (playerNo >= 11)
{
Console.WriteLine("*** Error in player number: " + x + 1 + " " + "is too high");
}
else

{
Console.Write("Enter player number or 999  to quit", playerNo);

}

{

Players[x, 0] = Convert.ToInt32(baseZero);
Players[x, 1] = Convert.ToInt32(baseOne);
Players[x, 2] = Convert.ToInt32(baseTwo);
Players[x, 3] = Convert.ToString(baseThree);
Players[x, 4] = Convert.ToString(baseFour);

}

}

Console.WriteLine("Player Summary");
Console.WriteLine("Player  Bases ");
Console.WriteLine("   {0,6}, {1,6}, {2,6}, {3,6}, {4,6}", "Zero", "One", "Two", "Three", "Four" + "\n");

for (x = 0; x < 3; x++)
{

Console.WriteLine(Players[x, 0]+ " " + Players[x, 1] + " " + Players[x,2] + " " + Players[x, 3] + " " + Players[x, 4] + " " + Players[x, 5] + "\n");

}

}

}
}
}

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

namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
//int count = 0, inputString,
int bbase= 0, playerNo = 0, x = 0;
int baseZero = 0, baseOne = 0, baseTwo = 0, baseThree = 0, baseFour = 0;
//string[,] Players = new string[3, 5];

int[,] Players = new int[3, 5];
for ( x = 0; x < 3; x++)
{

Console.Write("Enter player number ", x + 1);

while (playerNo != 999)
{

Console.Write("Enter the bases", x + 1);

if (bbase >= 5)
{
Console.WriteLine("***Error in number of bases:  " + bbase + " " + "is too high");

}

baseZero = 0 * bbase;
baseOne = 1 * bbase;
baseTwo = 2 * bbase;
baseThree = 3 * bbase;
baseFour = 4 * bbase;

if (playerNo >= 11)
{
Console.WriteLine("*** Error in player number: " + x + 1 + " " + "is too high");
}
else

{
Console.Write("Enter player number or 999  to quit", playerNo);

}

{

Players[x, 0] = Convert.ToInt32(baseZero);
Players[x, 1] = Convert.ToInt32(baseOne);
Players[x, 2] = Convert.ToInt32(baseTwo);
Players[x, 3] = Convert.ToString(baseThree);

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

namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
//int count = 0, inputString,
int bbase= 0, playerNo = 0, x = 0;
int baseZero = 0, baseOne = 0, baseTwo = 0, baseThree = 0, baseFour = 0;
//string[,] Players = new string[3, 5];

int[,] Players = new int[3, 5];
for ( x = 0; x < 3; x++)
{

Console.Write("Enter player number ", x + 1);

while (playerNo != 999)
{

Console.Write("Enter the bases", x + 1);

if (bbase >= 5)
{
Console.WriteLine("***Error in number of bases:  " + bbase + " " + "is too high");

}

baseZero = 0 * bbase;
baseOne = 1 * bbase;
baseTwo = 2 * bbase;
baseThree = 3 * bbase;
baseFour = 4 * bbase;

if (playerNo >= 11)
{
Console.WriteLine("*** Error in player number: " + x + 1 + " " + "is too high");
}
else

{
Console.Write("Enter player number or 999  to quit", playerNo);

}

{

Players[x, 0] = Convert.ToInt32(baseZero);
Players[x, 1] = Convert.ToInt32(baseOne);
Players[x, 2] = Convert.ToInt32(baseTwo);
// Players[x, 3] = Convert.ToString(baseThree);
// Players[x, 4] = Convert.ToString(baseFour);

}

}

Console.WriteLine("Player Summary");
Console.WriteLine("Player  Bases ");
Console.WriteLine("   {0,6}, {1,6}, {2,6}, {3,6}, {4,6}", "Zero", "One", "Two", "Three", "Four" + "\n");

for (x = 0; x < 3; x++)
{

Console.WriteLine(Players[x, 0]+ " " + Players[x, 1] + " " + Players[x,2] + " " + Players[x, 3] + " " + Players[x, 4] + " " + Players[x, 5] + "\n");

}

}

}
}
}
``````

Players[x, 4] = Convert.ToString(baseFour);

``````                    }

}

Console.WriteLine("Player Summary");
Console.WriteLine("Player  Bases ");
Console.WriteLine("   {0,6}, {1,6}, {2,6}, {3,6}, {4,6}", "Zero", "One", "Two", "Three", "Four" + "\n");

for (x = 0; x < 3; x++)
{

Console.WriteLine(Players[x, 0]+ " " + Players[x, 1] + " " + Players[x,2] + " " + Players[x, 3] + " " + Players[x, 4] + " " + Players[x, 5] + "\n");

}

}

}
}
}
``````

`Inline Code Example Here`

Here's some code to look at:

``````using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
int bbase = 0, playerNo = 0, dataentryerror = 0;
int[,] PlayersStats = new int[12, 5];

while(true)
{
bool goodentry =false;
while (!goodentry)
{
Console.Write("Enter the Player's Number(0-11)(999 to finish): ");
if (goodentry && ((playerNo >= 0 && playerNo < 12) || playerNo == 999))
break;
goodentry = false;
dataentryerror +=1;
}
if (playerNo == 999)
break;
for (int i = 0; i < 5; i++)
{
goodentry = false;
while (!goodentry)
{
Console.Write("Enter Player " + playerNo + "'s bases for turn at bat number " + i + ": ");
Console.WriteLine();
if (goodentry && bbase >= 0 && bbase < 5)
{
}
else
{
goodentry = false;
dataentryerror += 1;
}
}
}
Console.Clear();
}
Console.WriteLine("Player No.\t0-bases\t1-bases\t2-bases\t3-bases\t4-bases");
for (int i = 0; i < 12; i++)
{
Console.Write("    "+ i + "\t");
for (int j = 0; j < 5; j++)
{
}
Console.WriteLine();

}
Console.WriteLine("\n\nData Entry Errors: " + dataentryerror + "\n");
}

}
}
``````

This code assumes the standard teeball rules, 5 innings and every player gets 5 turns at bat.

This code is correct. exellent!

I'm glad that works for you. Please remember to mark this solved thanks.

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.