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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!