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

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).

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

headers import javautil import javalang import javaio class Cricket private data members private int totalODItotalTESTtotalT20CenturyHalfcenturytotalrunstotalwickets parameterized constructor Cricketi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!