Question: (Program in SCALA and please use a main method to call the functions) Question: In a package named execution create a Scala class named Team

(Program in SCALA and please use a main method to call the functions)(Program in SCALA and please use a main method to call the

Question: In a package named "execution" create a Scala class named "Team" and a Scala object named "Referee". Team will have: State values of type Int representing the strength of the team's offense and defense with a constructor to set these values. The parameters for the constructor should be offense then defense A third state variable named "score" of type Int that is not in the constructor, is declared as a var, and is initialized to O Referee will have: A method named "playGame" that takes two Team objects as parameters and return type Unit. This method will alter the state of each input Team by setting their scores equal to their offense minus the other Team's defense. If a Team's offense is less than the other Team's defense their score should be 0 (no negative scores) A method named "declareWinner" that takes two Teams as parameters and returns the Team with the higher score. If both Teams have the same score, return a new Team object with offense and defense both set to O Question: In a package named "execution" create a Scala class named "Team" and a Scala object named "Referee". Team will have: State values of type Int representing the strength of the team's offense and defense with a constructor to set these values. The parameters for the constructor should be offense then defense A third state variable named "score" of type Int that is not in the constructor, is declared as a var, and is initialized to O Referee will have: A method named "playGame" that takes two Team objects as parameters and return type Unit. This method will alter the state of each input Team by setting their scores equal to their offense minus the other Team's defense. If a Team's offense is less than the other Team's defense their score should be 0 (no negative scores) A method named "declareWinner" that takes two Teams as parameters and returns the Team with the higher score. If both Teams have the same score, return a new Team object with offense and defense both set to O

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!