Create a class named Cricket having the following private data members: total_ODI,total_TEST,total_T20,Century,Half_century,total_runs,total_wickets Two classes,
Question:
Create a class named “Cricket” having the following private data
members: total_ODI,total_TEST,total_T20,Century,Half_century,total_runs,total_wickets
Two classes, “Batsmans” and “Bowlers”, inherits the “Cricket” class. The
“Batsmans” and “Bowler” both classes have the private data members “Name”, “total_match.” Also, declare necessary parameterized constructors, getter, setter, and toString methods in all the classes.
i) Now create objects of “Batsmans” and “Bowlers” classes for the 10
batsman and 10 bowlers, respectively. Then print all information using
toString methods. (Note: use array of objects)
Hint: variables input: all user input except one variable.
ii) Now create two Interfaces named Games1 and Games2, having the
Following abstract methods:
Games1:averageOfODI(arr[]:Batsmans):double, mostCentury(arr[]:Batsmans):void
Games2:mostWickets(arr[]:Bowlers):void,lessMatches(arr[]:Bowlers):void
“Batsmans” and “Bowlers” inherits the
“Games1 ” and “Games2 ” classes, respectively.
averageOfODI(): It will calculate the average of total ODI matches. mostCentury(): It will find and print informations of the cricketer with
most century.
mostWickets(): It will find and print informations of the cricketer with most
wickets.
lessMatches(): It will find and print informations of the cricketer with less
matches.
Note: Use the objects of question (i) to solve the question (ii).