Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

headers import javautil import javalang import javaio class Cricket private data members private int totalODItotalTESTtotalT20CenturyHalfcenturytotalrunstotalwickets parameterized constructor Cricketi... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions

Question

How does senescence occur?

Answered: 1 week ago

Question

3 > O Actual direct-labour hours Standard direct-labour hours...

Answered: 1 week ago