Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The application will allow the user to calculate the cricket player's points as per following specifications. Page 1 of 4 Player class: This is
The application will allow the user to calculate the cricket player's points as per following specifications. Page 1 of 4 Player class: This is an abstract class will have following static properties: Team-such as "Giant Titans" Number of Purple Cap awards; value must be 1 Number of Orange Shoes awards; value must be 1 and non-static properties: Player's Name - such as "Brat Lee" Number of overs played - such as 5 Points Achieved - such a 100 Constructor: Parameterized constructor with parameters only for player name and number of overs played Methods: getPoints(): this is an abstract function toString(): this function returns a string containing all necessary information except points achieved in appropriate format. Bowler class: This class inherits from Player class. Properties: Total runs given - such as 25 Total wickets taken - such as 4 Constructor: Create a parameterized constructor with runs given and wickets taken parameters in addition to any necessary parameters required for super class. Methods: getPoints(): this function must return points achieved based on following criteria: calculate the average runs (total runs given / number of overs played) Calculate the points based on average runs as per the following table Average Runs 6 or more 4 or more 3 Otherwise Points 5 10 25 50 Player also gets 10 points for each wicket taken if they have taken 3 or more wickets; otherwise, they get 5 points for each wicket taken. toString(): this function returns a string containing all necessary information including the points achieved in appropriate format. WICKET_TYPE enumeration: This enumeration represents wicket types as per following values: RUN OUT, BOWLED, LBW, CATCH OUT, NOT_OUT Batsman class: This class inherits from Player class. Properties: total runs scored - such as 40 wicket type - WICKET_TYPE enumeration - such as CATCH_OUT Constructor: Create a parameterized constructor with total runs scored and wicket type parameters in addition to any necessary parameters required for super class. Methods: getPoints(): this function must return points achieved based on following criteria: calculate the average runs (total runs given / number of overs played) Calculate the points based on average runs as per the following table Average Runs 6 or more 4 or more 3 Otherwise Player also gets 20 points for wicket type NOT_OUT. Points 100 75 50 25 Player gets deduction of 10 points if their wicket type is BOWLED or RUN_OUT. toString(): this function returns a string containing all necessary information including the points achieved in appropriate format. PlayerTest Class: To test the above-mentioned classes, create a class named PlayerTest. This class will contain the main() method that should perform the following operations: Create ArrayList of Player class Create 3 objects of Batsman and Bowler classes each; add the objects to the ArrayList (use different parameter values passed to the constructor to demonstrate different point calculations) Iterate the ArrayList to display all the information about the player, Check if any player has scored more than 100 points. If yes, if the player is a Batsman, display the message that the player gets PurpleCap award; and decrease the number of purple cap awards. Only one batsman can get the purple cap award. if the player is a Bowler, display the message that the player gets OrangeShoes award; and decrease the number of orange shoes awards. Only one bowler can get the orange shoes award. You don't have to read any input from user. Example Output: Bowler{Player{team='Giant Titans', playerName="Tim", oversPlayed-5), runs Given-20, wickets Taken-5, Points Achieved=60} Bowler{Player(team='Giant Titans', playerName="Max", oversPlayed-10), runs Given-30, wicketsTaken=8, Points Achieved=105} Orange Shoes awarded to Max Bowler{Player(team-'Giant Titans', playerName='Brat, oversPlayed-7), runs Given-40, wickets Taken=0, Points Achieved=10} Batsman{Player(team-'Giant Titans', playerName='Steve', oversPlayed-6}, runs Scored-70, wicketType=NOT_OUT, points Achieved=120} Purple Cap awarded to Steve Batsman{Player(team-'Giant Titans', playerName='Vivian', overs Played=15), runs Scored-50, wicketType=BOWLED, pointsAchieved=40} Batsman{Player{team="Giant Titans', playerName='Brad', overs Played-20), runs Scored=125, wicketType=CATCH OUT, points Achieved 100}
Step by Step Solution
★★★★★
3.35 Rating (164 Votes )
There are 3 Steps involved in it
Step: 1
Heres a comprehensive solution for the singlylinked list implementation in Java incorporating the insights from the descriptions of the images and add...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started