The application will allow the user to calculate the cricket player's points as per following specifications....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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} 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}
Expert Answer:
Answer rating: 100% (QA)
Heres a comprehensive solution for the singlylinked list implementation in Java incorporating the insights from the descriptions of the images and add... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
4. Define a class Person according to the following UML: Person -name: String -age: int + Person (name: String, age: int) + setName (name: String): void + getName(): String + setAge (age: int) : void...
-
What is the internal rate of return for the following project: An initial outlay of $9,000 resulting in a single cash inflow of $16,452 in 7 year The internal rate of return for the project is %....
-
Paige buys a tool shed priced at $5990, but pays $6289.50 with tax. What is the tax rate where Paige lives?
-
Kimberly Manufacturing uses a process-costing system to manufacture Dust Density Sensors for the mining industry. The following information pertains to operations for the month of May, Year 5. Units...
-
Suppose that is a twice-differentiable function of r, that r = x 2 + y 2 + z 2 , and that Show that for some constants a and b, fxx + fyy + fz = 0.
-
On October 1, 2017, Gordon borrows \($150\),000 cash from a bank by signing a three-year installment note bearing 10% interest. The note requires equal payments of \($60\),316 each year on September...
-
Nevin Company makes three products in its factory: plastic cups, plastic tablecloths, and plastic bottles. The expected overhead costs for the next fiscal year include the following. Nevin uses...
-
3. The distance between carbon atoms in diamond is 0.154 nm. What is this distance in meters? Have Factor 0.154 nm 1 x 10^9nm Want 1.54 x 10^-10m 4. Calculate the number of grams in 32.0 lbs....
-
Carrington Oil produces gas 1 and gas 2 from two types of crude oil: crude 1 and crude 2. Gas 1 is allowed to contain up to 4% impurities, and gas 2 is allowed to contain up to 3% impurities. Gas 1...
-
Research the Bonds, Bond valuation, and return on Capital Assets of Wal-Mart, and explain how healthy or unhealthy the company is based on your findings
-
Suppose you are the supplier, you concluded this deal with the buyer on Paypal. Unfortunately, you find the buyer reversed the payment after taking over your shipment. So you are now mailing to...
-
A firm pays a dividend of $1 per share next year. The dividend is expected to grow at an annual rate of 2%. What is the value of the firm if the interest rate in the economy is 5%?
-
A bond that settles on June 7, 2019, matures on July 1, 2039, and may be called at any time after July 1, 2029, at a price of 136. The coupon rate on the bond is 6.4 percent and the price is 151.00....
-
Can you please help me with this question! Topic 7 - Structure across time Is it possible to understand why languages change over time without having a good understanding of what drives variation at...
-
Imagine yourself to be an entrepreneur, you are presenting a business plan to investors to convince them to invest in your business? Discuss some focal points of such a discussion.
-
Evaluate x+4x2-5x+4 dx. 1-x A. x3 -x2 4 In|1- x|+ C C. -x -x? - 4In|1 - x| + C D. -x3 +x? + 4 In|1 x| + C 3 B.x3 =x 4 In|1 x| + C 3 3
-
Q:1 Take any product or service offered in Pakistan and apply all determinents of customer Perceived value ?
-
Professor Patricia (Patty) Pate is retired from the PalmSprings Culinary Arts Academy (PSCAA). She is a single taxpayer and is 68 years old. Patty lives at 98 Colander Street, Henderson, NV 89052....
-
Clifford Johnson has a limited partnership investment and a rental condominium. Clifford actively manages the rental condominium. During 2012, his share of the loss from the limited partnership was...
-
Joan is a self-employed attorney in New York City. Joan took a trip to San Diego, CA, primarily for business, to consult with a client and take a short vacation. On the trip, Joan incurred the...
-
Go to https://www.youtube.com/watch?v=Fp9m4GNwGng to view a brief video on the Brazilian Jet manufacturer Embraer and their use of Critical Chain Project Management for maintenance services. How has...
-
It is sometimes argued that state revenue generated by lotteries is different from tax revenue because people choose to buy lottery tickets. Compare three state revenue sources cigarette excise...
-
Suppose that the demand for personalized license plates and the marginal cost of production in a state is as shown in Figure 16.1. If all the profits go to the government and the state wants to...
Study smarter with the SolutionInn App