0% found this document useful (0 votes)
16 views4 pages

Cricket Player Database System

The document outlines a project for creating a Cricket Player Database System in Java, which manages player information for IPL cricket clubs. It specifies features such as searching for players and clubs, adding players, and generating reports, with a focus on user-friendly command-line interaction. The system will automatically load and save player data from a text file named 'players.txt' and includes detailed requirements for input handling and data structure management.

Uploaded by

alaminbuetcse22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Cricket Player Database System

The document outlines a project for creating a Cricket Player Database System in Java, which manages player information for IPL cricket clubs. It specifies features such as searching for players and clubs, adding players, and generating reports, with a focus on user-friendly command-line interaction. The system will automatically load and save player data from a text file named 'players.txt' and includes detailed requirements for input handling and data structure management.

Uploaded by

alaminbuetcse22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CSE 108: Java Term Project (Part 1)

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:

Player Searching Options:


(1) By Player Name
(2) By Club and Country
(3) By Position
(4) By Salary Range
(5) Country-wise player count
(6) Back to Main Menu

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:

Club Searching Options:


(1) Player(s) with the maximum salary of a club
(2) Player(s) with the maximum age of a club
(3) Player(s) with the maximum height of a club
(4) Total yearly salary of a club
(5) Back to Main Menu

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.

Option (3) of the Main Menu


Option (3) of the main menu allows the user to add a new player to the database. You have to
take input for all the information of a player. All player names are unique - if a player with the
inputted name is already in the database, you cannot add this player, and you should display
“Player with this name already exists”

Option (4) of the Main Menu


Option (4) of the main menu exits the program. All the players currently in memory are
automatically saved back to "players.txt" if any new player is added. Inputs other than 1-4 to this
main menu should be rejected, and an error message should be printed. The menu should be
displayed repeatedly until the user chooses Option (4).

Input File Format


The input data file (players.txt) has the following format for each line: (Note that there is no
space between a word and a comma).

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy