Question: I have to create a program that creates a MLB Baseball Franchise. I created the interface that I have to implement and the abstract class
I have to create a program that creates a MLB Baseball Franchise. I created the interface that I have to implement and the abstract class I have to extend. The abstract class will be the guideline for creating a baseball team in the MLB (Major League Baseball). The interface will be a template for creating a player for a baseball team. Lastly, I have to create a class that will implement the CreateGame interface. This class will simulate a game played between two teams. The simulation will run in a class called PlayBall. I have to do the following: Implement the CreatePlayer Interface Extend the Team Abstract Class Implement the CreateGame Interface Run the game Show the current score while game is played after each inning. Show the final score when the game ends. Determine the winner and print the winners name and final score create player interface below: public interface CreatePlayer { public class BaseBallPlayer implements CreatePlayer { String name; String position; int age; boolean isout=false; @Override public void setPlayerName(String name) { // TODO Auto-generated method stub this.name=name; } @Override public String getPlayerName() { // TODO Auto-generated method stub return name; } @Override public void setPlayerPosition(String position) { // TODO Auto-generated method stub this.position=position; } @Override public String getPlayerPosition() { // TODO Auto-generated method stub return position; } @Override public void setPlayerAge(int age) { // TODO Auto-generated method stub this.age=age; } @Override public int getPlayerAge() { // TODO Auto-generated method stub return age; } } --------------------------- public class BaseBallTeam extends Team { String name; String city; BaseBallPlayer[] players=new BaseBallPlayer[this.rosterCount]; boolean Allout; public void addPlayers(BaseBallPlayer[] players) { this.players=players; } @Override public void setTeamName(String name) { // TODO Auto-generated method stub this.name=name; } @Override public String getTeamName() { // TODO Auto-generated method stub return name; } @Override public void setTeamCity(String city) { // TODO Auto-generated method stub this.city=city; } @Override public String getTeamCity() { // TODO Auto-generated method stub return city; } } --------------------------------------- import java.util.Random; public class BaseBallGame implements CreateGame{ int innings; String winner; BaseBallTeam teamA; BaseBallTeam teamB; BaseBallTeam battingteam; BaseBallTeam ballingteam; Random random = new Random(); BaseBallGame(BaseBallTeam a,BaseBallTeam b,int inn) { innings=inn; teamA=a; teamB=b; } @Override public void runGame() { // TODO Auto-generated method stub // syntax to generate number between min and max(min and max both are inclusive) //int randomNumber = random.nextInt(max + 1 - min) + min; int randomNumber = random.nextInt(1 + 1 - 0) + 0; if(randomNumber==1) { battingteam=teamA; } else { ballingteam=teamB; } [213;.'1as for(int i=0;i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
