Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Create a baseball lineup for a PONY baseball team

+2 votes
asked May 13, 2019 by Horace Cheung (140 points)

 Create a baseball lineup for a PONY baseball team

User Requirements A manager of a PONY (Protect Our Nation’s Youth) baseball team has hired you to design a program that creates a baseball lineup and position assignment. The lineup (i.e., the batting order from 1st to last) will be based on the batting average of each player. For example, if Joshua has an average of 692 and Jackson has an average of 459, Joshua will be placed first in the lineup, followed by Jackson. In terms of the position assignment (i.e., Joshua plays 1st base in inning 1, 3rd base in inning 2, center field in inning 3, etc.) your program must assign the field positions for each defensive player in accordance to the PONY Shetland rules stated below.

1. The line-up should include batting order and player’s defensive positions for each of the five innings.

2. 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 20 feet to the baseline when the ball is hit and will be considered outfielders.

3. Each player must be scheduled to play an infield position at least one (1) inning. Catcher will be considered an infield position. A player may only be scheduled to play catcher a maximum of one (1) inning per game. No player may play a second inning of infield until every other player has played one inning of infield.

4. A player cannot play the same defensive position for more than one (1) inning per game.

5. A player can only sit out one (1) inning per game

Enter 12 player names:

What is player 1’s name: Jackson

What is player 2’s name: Ben

What is player 3’s name: Harper

What is player 4’s name: Mason

What is player 5’s name: Sean

 What is player 6’s name: Robert

What is player 7’s name: Hayden

 What is player 8’s name: James

 What is player 9’s name: Luke

 What is player 10’s name: Ryan

What is player 11’s name: Grant

What is player 12’s name: Joshua

Enter the averages for each player:


What is Jackson’s average: 399

What is Ben’s average: 616

What is Harper’s average: 511

What is Mason’s average: 647

What is Sean’s average: 401

What is Robert’s average: 545

What is Hayden’s average: 533

What is James’s average: 632

What is Luke’s average: 499

What is Ryan’s average: 470

What is Grant’s average: 578

What is Joshua’s average: 777

Game lineup and field positions:


Name Inning 1   Inning 2   Inning 3    Inning 4      Inning 5

Joshua RF              2B           RCF             OUT             P

Mason RCF            3B           LCF            1B              OUT

James   2B              RF          OUT            C                    LF

Ben       1B            RCF          P               OUT               SS

Grant      P            OUT        1B               LCF              RF

Robert   LCF            1B          OUT           2B            RCF

Hayden   LF             SS           RF              3B               C

Harper    C            LCF            SS             RF               2B

Luke       SS            LF             3B               P               OUT

Ryan      OUT         C               LF              RCF             3B

Sean       3B         OUT             2B               LF               1B

Jackson   OUT        P                C                SS               LCF

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.

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 2D array, a first index whole number, and a last index whole number. The void function must use the divide-and-conquer approach as described in your text.

You are permitted to create any additional arrays, variables, functions, etc. towards the completion of this project.

Thank you so much

1 Answer

+1 vote
answered Jan 5 by Max Jian (710 points)
Are you asking for an answer or something
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.