Cricket Player Database System
Cricket Player Database System
You are required to write a program that implements a simple player database of IPL cricket
clubs. This cricket player database system aims to keep a database of the players and perform
operations such as searching for players, searching for clubs, adding players, etc.
The Cricket Player Database System should provide the following features:
● Maintains a list (using a Java Collection class) of Player objects
● Each Player object represents a single-player
● Each player should contain the following information:
○ Name
○ Country
○ Age in years
○ Height in meters
○ Club
○ Position (can be Batsman, Baller, Wicketkeeper, Allrounder)
○ Number (Jersey number)
○ Weekly Salary
● Players can be added to the list
● Lists the details of an existing player (or players)
● Produces a report of players based on some criteria
● Produces different statistics of the clubs and country
● Loads a list of players from a text file and saves the list of current players to a text file
When the cricket player database system starts, it should automatically load a text file called
"players.txt", which contains details of all players currently kept by the database. The actual
format of this text file is described later in this document. The data loaded should be stored in
some appropriate data structures. No other reading from or writing to the file is required while
the program is in operation until the user chooses to exit, at which point the program saves all
the data in memory back to the same text file (players.txt). In other words, the file I/O operations
are performed automatically by the program and require no direct interactions with the user.
Main Menu
When the program is running, it should repeatedly display the command line based main menu
with these options:
Main Menu:
(1) Search Players
(2) Search Clubs
(3) Add Player
(4) Exit System
Option (1) of the Main Menu
Option (1) of the main menu allows the user to search for players in the database. The user
should be asked what criteria(s) he/she wants to use to search for players. The following
sub-menu and options should be displayed:
Inputs other than 1-6 should be rejected, and an error message should be printed. The menu
should be displayed repeatedly until the user chooses Option (6).
If the user chooses option (1), you should ask the user to input a player name and then search
the database for any player with the specific name. If found, display all information of this player
or display “No such player with this name” if not found.
If the user chooses option (2), you should ask the user to input a country first and then ask the
user to input a club. The user can input a club name (e.g., “Royal Challengers Bangalore”) or
“ANY.” If “ANY” is inputted, the program should display all players of this country from the
database. Display all information of players with this country and this club (or all clubs if “ANY”
is inputted) if found, or display “No such player with this country and club” if not found.
If the user chooses option (3), you should ask the user to input a position and then search the
database for any player with the specific position. If found, display all the players or display “No
such player with this position” if not found.
If the user chooses option (4), you should ask the user to input two numbers as a range and
then search the database for any player with a weekly salary in this range. If found, display all
the players or display “No such player with this weekly salary range” if not found.
If the user chooses option (5), display the country-wise count of players. You don’t need to take
any input from the users.
If the user chooses option (6), the program should go back to the main menu.
Option (2) of the Main Menu
Option (2) of the main menu allows the user to search for players of specific clubs in the
database. The user should be asked what criteria(s) he/she wants to use to search. The
following sub-menu and options should be displayed:
Inputs other than 1-5 should be rejected, and an error message should be printed. The menu
should be displayed repeatedly until the user chooses Option (5)
If the user chooses option (1), you should ask the user to input a club name and then search for
the players with the maximum weekly salary. Display all information about these players if the
club is found, or display “No such club with this name” if not found.
If the user chooses option (2), you should ask the user to input a club name and then search for
the players with the maximum age. Display all information about these players if the club is
found, or display “No such club with this name” if not found.
If the user chooses option (3), you should ask the user to input a club name and then search for
the players with the maximum height. Display all information about these players if the club is
found, or display “No such club with this name” if not found.
If the user chooses option (4), you should ask the user to input a club name and then find out
the total yearly salary of all the players of this club. Display the total salary for the club, or
display “No such club with this name” if not found.
If the user chooses option (5), the program should go back to the main menu.
Name,Country,Age,Height,Club,Position,Number,WeeklySalary
Name, Country, Club, and Position are Strings.
Age, Number, and WeeklySalary are positive integers.
Height is positive doubles.
Number (Jersey number) is optional and can be empty.
Important Assumptions
You should assume the following when implementing your program:
● You are not allowed to hardcode anything
● You have to reuse your code later, so design and code accordingly
● There is no limit to how many players can be stored
● When performing searches, all search strings are not case-sensitive
● The data file is always in the correct format - i.e., no need to validate the data when
reading it in
● All on-screen input/output should be formatted in a user-friendly manner. Sensible error
messages should be displayed whenever appropriate (e.g. when searching for a player
who is not in the database, a “Not Found” error message should be displayed)
● You are not allowed to use JavaFX or Java Swing for this part; everything should be
command line based