State Board of Cricket Council - Requirement Document 4
State Board of Cricket Council - Requirement Document 4
The State Board of Cricket Council (SBCC) wants the system to segregate the Players based on
the player type. The player type should be either Batsman or Bowler. If the player type is
“Batsman” then create a player of type Batsman. Else if the player type is “Bowler” create a
player of type Bowler. You being their software consultant have been approached to integrate this
functionality into the existing system.
The parsePlayerDetails method has to invoke the validatePlayerId method in the SBCCUtility
class. If the playerId is valid create the player based on the player type. If the playerType is
“Batsman” then, create a player of type Batsman and return the same. Else if the playerType is
“Bowler” then create a player of type Bowler and return the same. If the playerId is invalid then
this method has to return null.
Create a concrete sub class named Batsman that inherits the Player class. The findStarRating
method in the Batsman class has to calculate the rating of the player based on the number of
hundreds and number of fifties scored by the batsman and set this rating value to starRating
attribute in the Batsman class.
For eg:
HXCB1124D:Dhoni:5:50:130:55:102:100:North:Batsman:3:2
Create a concrete sub class named Bowler that inherits the Player class. The findStarRating
method in the Bowler class has to calculate the rating of the player based on the number of
maiden overs and number of hat-trick wickets taken by the bowler and set this rating value to
starRating attribute in the Bowler class.
For eg:
SAFG1243P:Mahee:3:20:30:55:South:Bowler:4:0
In the UserInterface class, in the main method provided, fill the code to produce the output as
shown in the Sample input and Output.
When the user selects option 1 i.e., Validate player details, it should get the player details from
the user, and invoke the method to parse the player details. If valid player is returned then display
the player details such as playerId, playerName, matchesPlayed, runScored and playingZone, else
display "Please provide a valid record".
When the user selects option 2 i.e., Create Batsman or Bowler, it should get the player details
from the user, and invoke the method to parse the player details. If valid player is returned then
display the player details based on the player type (Batsman or Bowler), else display "Please
provide a valid record".
When the user selects option 3 i.e., Exit, display the message "Thank you for using SBCC
application" and end the program.
Sample Input and Output 1 [Values given in bold represents the input]:
3. Exit
HXCB1234D:Dhoni:5:50:130:55:102:100:North:Batsman:3:2
Number of Hundreds: 3
Number of Fifties: 2
SAFG1243P:Mahee:3:20:30:55:South:Bowler:4:0
Number of Maidens: 4
Number of Hattricks: 0
3. Exit
HXC234D:Dhoni:5:20:130:55:102:100:North:Batsman:3:1
// Note: Display the message << Please provide a valid record>> if the parsePlayerDetails method returns null
3. Exit
Enter your choice
HXCB1234D:Dhoni:5:20:130:55:102:100:North:Batsman:3:1
3. Exit
HXC234D:Dhoni:5:20:130:55:102:100:North:Batsman:3:1
// Note: Display the message << Please provide a valid record>> if the parsePlayerDetails method returns null
3. Exit