Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a baseball lineup for a PONY baseball team User Requirements A manager of a PONY ( Protect Our Nation s Youth ) baseball team
Create a baseball lineup for a PONY baseball team
User Requirements
A manager of a PONY Protect Our Nations Youth baseball team has hired you to design a program that creates a
baseball lineup and position assignment. The lineup ie the batting order from st to last will be based on the batting
average of each player. For example, if Joshua has an average of and Jackson has an average of Joshua will be
placed first in the lineup, followed by Jackson.
In terms of the position assignment ie Joshua plays st base in inning rd base in inning center field in inning
etc. your program must assign the field positions for each defensive player in accordance to the PONY Shetland rules
stated below.
The lineup should include batting order and players defensive positions for each of the five innings.
Each team shall play all players in the field in defensive positions. Additional players, short fielders shall be
positioned in the outfield no closer than feet to the baseline when the ball is hit and will be considered
outfielders.
Each player must be scheduled to play an infield position at least one inning. Catcher will be considered an
infield position. A player may only be scheduled to play catcher a maximum of one inning per game. No
player may play a second inning of infield until every other player has played one inning of infield.
A player cannot play the same defensive position for more than one inning per game.
A player can only sit out one inning per game.
Software Requirements
Create a flowchart or pseudo code to establish an algorithm of how to solve this problem.
Use a two dimensional string array to store the lineup player names and position assignments for each player as seen
above.
You can use an iterative approach to display the array, but if you are going to use a recursive approach, use a recursive
function to display the names and positions of the lineup and field positions. This recursive function must be a void
function called displayArray that receives a D array, a first index whole number, and a last index whole number. The
void function must use the divideandconquer approach as described in your text.
You are permitted to create any additional arrays, variables, functions, etc. towards the completion of this project.
Has to contain the 'main' function. Program execution begins and
ends there.
#include
#include
using namespace std;
struct player
string name;
int average;
;
const int TEAMSIZE ;
const int NUMINNINGS ;
void displayArraystring inningsTEAMSIZENUMINNINGS ;
int main
Declarations
player playersTEAMSIZE;
Get user input
cout "Enter player names: endl;
for int i ; i TEAMSIZE; i
cout "What is player i s name: ;
cin playersiname;
cout "Enter the average for each player: endl;
cout endl;
for int i ; i TEAMSIZE; i
cout "What is playersiname s average: ;
cin playersiaverage;
The string array used to store the lineup of
player names and player position assignment
string inningsTEAMSIZENUMINNINGS ;
Calculate positions
Display result
displayArrayinnings;
systempause;
return ;
void displayArraystring inningsTEAMSIZENUMINNINGS
cout "Game lineup and field positions:" endl;
cout endl;
cout "Name t Inning t Inning t Inning t Inning t Inning
endl;
for int i ; i TEAMSIZE; i
for int j ; j NUMINNINGS ; j
printfs inningsijcstr;
printf
;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started