For this exercise, you are given a Team superclass with a BaseballTeam and FootballTeam subclass. Take a moment to examine these classes and the instance variables and methods in each.

In the TeamTester class, you will see three objects declared and instantiated using the Team, FootballTeam, or BaseballTeam classes.

For each object, use a print statement to print out any public method that returns information that is available for that particular object, including the toString.

For example, the dolphin object is a FootballTeam object. One of the pieces of information that can be printed is the getTies() method, so you will call that method in your TeamTester file:

System.out.println(dolphins.getTies());
Do this for all the methods that each of the objects can call.

Hint: Remember, for the program to compile and run, Java looks for methods to exist in certain classes. public class BaseballTeam extends Team {

    private String league;

	public BaseballTeam(String name, String location,
                    int wins, int losses, String league) {
		super(name, location, wins, losses);
		this.league = league;
	}

	public String getLeague() {
		return league;
	}

	public void setLeague(String league) {
		this.league = league;
	}

} public  class FootballTeam extends Team {

    private int ties;


	public FootballTeam(String name, String location,
                    int wins, int losses, int ties) {
		super(name, location, wins, losses);
		this.ties = ties;
	}

	public int getTies() {
		return ties;
	}

	public void setTies(int ties) {
		this.ties = ties;
	}

	@Override
    public String toString(){
        return super.getWins() + " - " + super.getLosses() + " - " + ties;
    }
}public class Team {

    private String name;
    private String location;
    private int wins;
    private int losses;

	public Team(String name, String location, int wins, int losses) {
		this.name = name;
		this.location = location;
		this.wins = wins;
		this.losses = losses;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public int getWins() {
		return wins;
	}

	public void setWins(int wins) {
		this.wins = wins;
	}

	public int getLosses() {
		return losses;
	}

	public void setLosses(int losses) {
		this.losses = losses;
	}

    public String toString(){
        return wins + " - " + losses;
    }
}public class TeamTester {
    public static void main(String[] args) {
        FootballTeam dolphins = new FootballTeam("Dolphins", "Miami", 10, 5, 6);
        BaseballTeam yankees = new BaseballTeam("Yankees", "New York", 20, 10, "American League");
        Team wildcats = new Team("Wildcats", "Somewhere", 15, 5);
        System.out.println("Football Team Info:");
        System.out.println("Name: " + dolphins.getName());
        System.out.println("Location: " + dolphins.getLocation());
        System.out.println("Wins: " + dolphins.getWins());
        System.out.println("Losses: " + dolphins.getLosses());
        System.out.println("Ties: " + dolphins.getTies());
        System.out.println("ToString: " + dolphins.toString());
        System.out.println("\nBaseball Team Info:");
        System.out.println("Name: " + yankees.getName());
        System.out.println("Location: " + yankees.getLocation());
        System.out.println("Wins: " + yankees.getWins());
        System.out.println("Losses: " + yankees.getLosses());
        System.out.println("League: " + yankees.getLeague());
        System.out.println("ToString: " + yankees.toString());
        System.out.println("\nGeneric Team Info:");
        System.out.println("Name: " + wildcats.getName());
        System.out.println("Location: " + wildcats.getLocation());
        System.out.println("Wins: " + wildcats.getWins());
        System.out.println("Losses: " + wildcats.getLosses());
        System.out.println("ToString: " + wildcats.toString());
    }
}