Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write java program output: we changed access specifiers of all variables from public to private. In the constructor of Cricket class, create two objects of
Write java program
output:
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 playlnnings 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. 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 CricketDemo - randomValue: int randomNumber: Random Cricket + playCricket(); void theCricket + main(String[]); void theSimulator + Simulate() + simulateValues() the Player Player player Score: int batsmanName: String bowler Name: String balls: int overs: int - simulateValue: int - myCricket:String] + Player(String, String) + playinnings(Simulate):void + game Over(: void + getBatsmanNamel): String + getBowlerName: String + getPlayeScore(): 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 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 playlnnings 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. 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 CricketDemo - randomValue: int randomNumber: Random Cricket + playCricket(); void theCricket + main(String[]); void theSimulator + Simulate() + simulateValues() the Player Player player Score: int batsmanName: String bowler Name: String balls: int overs: int - simulateValue: int - myCricket:String] + Player(String, String) + playinnings(Simulate):void + game Over(: void + getBatsmanNamel): String + getBowlerName: String + getPlayeScore(): 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
Step: 1
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