Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an abstract class Bat And Ball Games with 4 data members and 4 members ou

ID: 670549 • Letter: C

Question

Create an abstract class Bat And Ball Games with 4 data members and 4 members out of the 4 data members 2 should be playersPerTeam and lengthofGame (i and out of the 4 member functions 2 should be display and rulessummary. function will show the current game score, overs etc. The rulessummary brief, say half a page, not 1000 pages. These methods will be implement subclasses. You can, of course, implement a method in the abstract clas in looking at possible member functions, note that both sports have a we Hall of Fame. create two concrete classes of the BatAndBallGames class for the games b and cricket. Each concrete class should have 2 new data members and 2 n functions. The data members and member functions in the 2 classes shoul the same. Write main() methods that create objects of each subclass, and send them messages to show the methods work. You can also try to create an object abstract class to see what messages get printed by various compilers.

Explanation / Answer

Import java.util.*;

Abstract class BatAndBallGames {

Abstract void show();

Abstract vod rulesSummary();

Int PlayersPertTeam;

Int LengthOfGame;

}

Concrete class BaseBall entends BatAAndBallGames {

Baseball( int x, int y) {

PlayersPerTeam = x;

LengthOfGame = y;

}

Void rulesSummary() {

System.out.println(“Baseball game rules”);

}

Void display() {

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote