this many times but couldn't get it. Thanks in advance Create a class to hold data about a high school sports team. The Team class holds data fields for high school name (such as Roosevelt High), sport (such as Girls’ Basketball), and team name (such as Dolphins). Include a constructor that takes parameters for each field, and include get methods that return the values of the fields. Also include a public final static String named MOTTO and initialize it to Sportsmanship!. Create a class named Game. Include two Team fields that hold data about the teams participating in the game. Also include a field for game time (for example, 7 PM). Include a constructor that takes parameters for two Team objects and a time. Include get methods for each field that return their respective values. public class Game {     private Team teamOne;     private Team teamTwo;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Have done this many times but couldn't get it. Thanks in advance

Create a class to hold data about a high school sports team. The Team class holds data fields for high school name (such as Roosevelt High), sport (such as Girls’ Basketball), and team name (such as Dolphins). Include a constructor that takes parameters for each field, and include get methods that return the values of the fields. Also include a public final static String named MOTTO and initialize it to Sportsmanship!.

Create a class named Game. Include two Team fields that hold data about the teams participating in the game. Also include a field for game time (for example, 7 PM). Include a constructor that takes parameters for two Team objects and a time. Include get methods for each field that return their respective values.

public class Game {
    private Team teamOne;
    private Team teamTwo;
    private String time;
    public Game(Team t1, Team t2, String time) {
        super();
        this.teamOne = teamOne;
        this.teamTwo = teamTwo;
        this.time = time;
    }
}
 
public class Team {
    private String schoolName;
    private String sportName;
    private String teamName;
    public final static String MOTTO = "Sportsmanship!";
    public Team(String schoolName, String sportName, String teamName) {
        this.schoolName = schoolName;
        this.sportName = sportName;
        this.teamName = teamName;
    }
    public String getschoolName() {
        return schoolName;
    }
    public String getSportName() {
        return sportName;
    }
    public String getTeamName() {
        return teamName;
    }
}
public class TestGame
{
   public static void main(String[] args)
   {
      Team team1 = new Team("Roosevelt High", "Girls Basketball", "Dolphins");
      Team team2 = new Team("Hoover High", "Girls Basketball", "Tigers");
      Game game1 = new Game(team1, team2, "7 PM");
      display(game1);
   }
   public static void display(Game g)
   {
      Team t1 = g.getTeam1();
      Team t2 = g.getTeam2();
      System.out.println("The game between " + t1.getName() + " " + t1.getSport() +
         " " + t1.getMascot());
      System.out.println("   and " + t2.getName() + " " + t2.getSport() +
         " " + t2.getMascot());
      System.out.println("   takes place at " + g.getTime());
   }
}
public class TestTeam
{
   public static void main(String[] args)
   {
      Team team1 = new Team("Roosevelt High", "Girls Basketball", "Dolphins");
      Team team2 = new Team("Hoover High", "Boys Wrestling", "Tigers");
      Team team3 = new Team ("Lincoln High", "Girls Field Hockey", "Gators");
      display(team1);
      display(team2);
      display(team3);
   }
   public static void display(Team t)
   {
      System.out.println(t.getName() + " " + t.getSport() +
         " team " + t.getMascot() + "\n   Our motto is " +
         t.MOTTO);
   }
}
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY