Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will help the Toronto Blue Jay\'s scouts decide which playe

ID: 3633666 • Letter: W

Question

Write a program that will help the Toronto Blue Jay's scouts decide which players they should draft next year. For each player the scouts have been watching, a record must be prepared showing the player's name, age, position, and batting average. Design a program that will ask the scout to enter information for 10 players into arrays. The program should then check each of the players and display statistics of only those players who are under 25 years old and have a batting average of .280 or better. Display the players that qualify sorted by their age.

A menu is required that has the following options:

1. Enter Blue Jay Data
2. Display possible Draft Choices
3. Exit Program

Option 2 should display output similar to the following:

*****************************************************************
Possible Blue Jay Draft Choices
*****************************************************************

NAME AGE POSITION AVERAGE
T. B. Slugger 22 D.H. .304
Frank Wills 24 Pitcher .281
*****************************************************************

Sample Data:
George Lyons,26,Third Base,.290
Watch T. Ball,21,First Base,.120
T.B. Slugger,22,D.H.,.304
Don Ferrall,27,Second Base,.291
Frank Wills,24,Pitcher,.281
Legs Bachman,25,L. Field,.321
etc.

**** IMPORTANT: I do not use any version newer than java 1.4.2. Please make sure that the program works with 1.4.2 and not any newer. Thank you. Lifesaver Ratings!

Explanation / Answer

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Scout
{
    public String Name;
    public int Age;
    public String Postion;
    public double Avg;
}
public class ScoutsInformationSystem
{  
    static Scout[] Scouts = new Scout[10];
    public static void main(String[] args)
    {
        InputStreamReader inp = null;
        BufferedReader input = null;
        int option = -1;
        try
        {
            while(true)
            {
                inp = new InputStreamReader(System.in);
                input = new BufferedReader(inp);
              
                System.out.println(" **** COMPUTERS R US Software Inventory ****");
                System.out.println("1. Enter Blue Jay Data");
                System.out.println("2. Display possible Draft Choices");
                System.out.println("3. Exit Program");
                System.out.println("Choose an action to perrform >> ");
                option = Integer.parseInt(input.readLine());
              
                switch(option)
                {
                    case 1:
                        AddNewScouts(input);
                        break;
                    case 2:
                        DisplayDraftChoices();
                        break;
                    case 3:
                        System.exit(0);
                        break;
                    default:
                        return;
                }
            }          
        }
        catch(Exception exp){}
    }
  
    private static void AddNewScouts(BufferedReader input) throws IOException
    {
        for(int i = 0;i<10;i++)
        {
            Scout sc=new Scout();
            System.out.println("Enter Name >> ");
            sc.Name = input.readLine();
            System.out.println("Enter Age >> ");
            sc.Age = Integer.parseInt(input.readLine());
            System.out.println("Enter Position >> ");
            sc.Postion = input.readLine();
            System.out.println("Enter Average >> ");
            sc.Avg = Double.parseDouble(input.readLine());
            Scouts[i] = sc;
        }
    }
  
    private static void DisplayDraftChoices()
    {
        for(int i=0;i<10;i++)
        {
            for(int j=i+1;j<10;j++)
            {
               if(Scouts[i].Age > Scouts[j].Age)
               {
                   Scout tmp = new Scout();
                   tmp = Scouts[i];
                   Scouts[i] = Scouts[j];
                   Scouts[j]=tmp;
               }
            }
        }
        System.out.println("*****************************************************************");
        System.out.println("Possible Blue Jay Draft Choices");
        System.out.println("*****************************************************************");
        System.out.println("NAME AGE POSITION AVERAGE");
        for(int i=0;i<10;i++)
        {
            if(Scouts[i].Age < 25 && Scouts[i].Avg >= 0.280)
                System.out.println(Scouts[i].Name+" "+Scouts[i].Age+" "+Scouts[i].Postion+" "+Scouts[i].Avg+" ");
        }
    }   
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote