Question
Instance variables: a) Declare instance variables named homeScore and visScore that are ints b) Declare instance variables named homeTeam and visTeam that are Strings Instance
Instance variables:
a) Declare instance variables named homeScore and visScore that are ints b) Declare instance variables named homeTeam and visTeam that are Strings
Instance methods:
c) Write a constructor that will receive four parameters two Strings and two ints corresponding to the home and visiting teams, then the home and visiting scores. The constructor will assign them to appropriate instance variables.
d) Write accessor methods for the score variables (one for each.)
e) Write mutator methods for the score variables (one for each.).
f) Write a toString() method that will display the winning teams (higher score
first).name and score, followed by the other team. If its a tie, show the home team first
/* Make sure all methods (in this case) are public and use standard naming conventions */
public class Game { // declare instance variables here
// write the answer to c here
// write the answer to d here
// write the answer to e here
// write the answer to f here
} // end class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started