SmolinskiW_Program03B.java
/**
* William Smolinski
* CISS 111
* Program03B - Modification to Program03A to show the use of interfaces
*/
public class SmolinskiW_Program03B
{
public static void main(String[] args)
{
//Creating the objects
BaseballTeam bostonRedSox = new BaseballTeam("Alex Cora", "Boston Red Sox", 9, 28);
FootballTeam pittsburghSteelers = new FootballTeam("Mike Tomlin", "Pittsburgh Steelers", 6, 53);
SportsTeam sportsTeam = new SportsTeam();
//Outputting information about the subclasses
System.out.println("BOSTON RED SOX INFO: \n");
System.out.println("To String method:");
System.out.println(bostonRedSox.toString() + "\n");
System.out.println("Sport info method:");
System.out.println(bostonRedSox.sportInfo() + "\n");
System.out.println("Display world series wins method:");
System.out.println(bostonRedSox.displayWorldSeriesWins() + "\n");
System.out.println("PITTSBURGH STEELERS INFO: \n");
System.out.println("To String method:");
System.out.println(pittsburghSteelers.toString() + "\n");
System.out.println("Sport info method:");
System.out.println(pittsburghSteelers.sportInfo() + "\n");
System.out.println("Display super bowl wins method:");
System.out.println(pittsburghSteelers.displaySuperBowlWins() + "\n");
//Outputting information about the superclass
System.out.println("SUPPER CLASS METHODS: \n");
System.out.println("To String method:");
System.out.println(sportsTeam.toString() + "\n");
System.out.println("Sport info method");
System.out.println(sportsTeam.sportInfo() + "\n");
//Program03B new outputs
System.out.println("BOSTON RED SOX INTERFACE DEMONSTRATION: ");
demonstrateInterfaceOutput(bostonRedSox);
System.out.println("PITTSBURGH STEELERS INTERFACE DEMONSTRATION: ");
demonstrateInterfaceOutput(pittsburghSteelers, pittsburghSteelers);
}
/**
* Method to show the use of an interface to get output
* @param team Sports team object to be used
*/
public static void demonstrateInterfaceOutput(PlayersOnTeam team)
{
System.out.println("Players on team: " + team.getTotalPlayersOnTeam() + "\n");
}
/**
* Method to show the use of an interface to get output
* @param team Sports team object to be used
* @param scoring Sports team object to be used
*/
public static void demonstrateInterfaceOutput(PlayersOnTeam team, FootballScoring scoring)
{
System.out.println("Points per touch down: " + scoring.getPointsPerTouchDown());
demonstrateInterfaceOutput(team);
}
}