Question: Write java program This increment is based on increment-5 in which we changed access specifiers of all variables from public to private. In the constructor
Write java program


This increment is based on increment-5 in which we changed access specifiers of all variables from public to private. In the constructor of Cricket class, create two objects of Player class. Moreover, when creating the instances, it should pass two string values such as "Abdul Razaq", "Jaques Kallis" to the constructor of Player class and initialize two variables batsmanName and bowlerName respectively. In the Cricket class, the playCricket() method should use the object variables of the player class to invoke the method playinnings method by passing Simulate object variable. For example, object of Player Class.playlnnings(SimulateObject). In the playlnning method of Player class, use the first object to invoke simulateValues method in Simulate class and get the random value generated by simulateValues(). Moreover, do the same for second object. In the player class, you have already created getters method for batsmanName, bowlerName, playerScore, balls and overs, etc in increment 5. If not, please complete this task in increment 6 and create/generate getters method for batsmanName, bowlerName, playerScore, balls and overs. www In the Cricket class, use two objects and get the player score. Compare both scores and determine who is the Winner. UML class diagram Figure 1. Increment 6 Cricket Simulate Cricket Demo - randomValue: int - randomNumber: Random theCricket Cricketo + main(String]); void playCricket(): void theSimulator - Simulate + simulateValues() thePlayer Player - playerScore: int batsmanName: String - bowlerName: String - balls: int - overs: int -simulateValue: int - myCricket:Stringi + Player(String, String) + playinnings(Simulate):void + gameOver(): void + getBatsmanName(): String getBowlerName(): String + getPlayerScore(): Int Hello, this is the first inning. The Batsman is Abdul Razaq The Bowler is Jaques Kallis Jaques Kallis take a start and bowled 1 ball out of crease and Stump Out The score is o Abdul Razaq's score was o Inning is over. Stay tuned and see you in a while Hello, this is the second inning. The Batsman is Jaques Kallis The Bowler is Abdul Razaq Abdul Razaq take a start and bowled 1 ball Leg Bye The score is now 1 Abdul Razaq take a start and bowled 2 ball Jaques Kallisleft Wide ball The score is now 2 Abdul Razaq take a start and bowled 3 ball A call for No Ball The score is now 3 Abdul Razaq take a start and bowled 4 ball Jaques Kallis take a double runs The score is now 5 Abdul Razaq take a start and bowled 5 ball What a Yorker Wicket Out The score is 5 Jaques Kallis's score was 5 Inning is over. Stay tuned and see you in a while What a wonderful match and Jaques Kallis Win
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
