Question: AP CS A JAVA: Say you have the following interface: //Filename: Football.java public interface Football { public void setHomeTeam(String team1); // sets the name of
AP CS A JAVA:
Say you have the following interface:
//Filename: Football.java
public interface Football
{
public void setHomeTeam(String team1);
// sets the name of the home team
public void setAwayTeam(String team2);
// sets the name of the away team
public void homeTeamScored(int points);
// adds the points scored to the total points for the home team
public void visitingTeamScored(int points);
// adds the points scored to the total points for the visiting team
public void WhatsTheFinalScore();
// prints out the final score for both teams and which team won
}
Write a class called Homecoming that will implement this interface. Note you are NOT responsible for creating a main to run it. (10 points). You may assume the following about this class:
- There will be class variables that are strings called hometeam & awayteam
- There are class variables that are ints called homescore and awayscore
- There will be a running total kept for each team's score and teams may score more than once
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
