This is it the big night Everything comes together here Variables TrickOrTreater

This is it, the big night! Everything comes together here. Variables: - TrickOrTreater[] cryptKickerFive - array of length 5 - TrickOrTreater[] ghoulGang - array of length 5 Constructors: - A constructor that takes in arrays for cryptKickerFive and ghoulGang (in this order). - You may assume that each input array is not null, and that neither array has null entries. Further, you may assume that each input array is of the expected length. You may shallow copy these arrays. Note: Even though this assignment guarantees each team will have five trick-or-treaters, do not hardcode the literal value 5 throughout this class. Write your code so that it would accommodate any pair of positive length arrays that share a length. Methods: - toString: To get a basic idea for the matchup, format a String representing HalloweenNight to this specification (no leading nor trailing whitespace, no angle brackets, no quotation marks, a single space following each colon and comma, and a single space preceding and following "versus"): versus ghoulGang: , , , , " - Use the String representations defined for each trick-or-treater. - Note: CKF represents the cryptKickerFive and GG represents the ghoulGang. The digit following the initials represents the index in the corresponding array. - Note: It is acceptable to hardcode your format string to anticipate five members on each team for this method. - compareTeams: Trick-or-treaters in each group could be off to a head start. Minding that, this method establishes rough criteria for which team begins at an advantage. Compare trick-or-treaters at matching indices of both teams (e.g., 0 and 0 ). The team with a higher count of greater trick-or-treaters is at an advantage. Print out the appropriate string based upon the conclusion followed by a newline: - "cryptKickerFive is favored." - "ghoulGang is favored." - "Neither team is favored." - battle: This method takes in a positive int representing the winning candy threshold. A team's total candy count must be at least this amount to win. If the input is nonpositive, default to 60. The instructions below describe the actions that a team should perform in one "turn". Each trick-or-treater on the team will trick-or-treat. Following trick-or-treating, each ghost on the team will attempt to rob the trick-or-treater at the same index (e.g., 0 and 0) of the other team. Hint: Think of an operator that checks if a given reference has an "is-a" relationship with a class or interface. Although this HW defines only two specific kinds of trick-or-treaters, design your code to hold up even if there were more than two kinds. The battle should begin with the cryptKickerFive taking a turn. Each team must take at least one turn. The first team to meet the winning candy threshold after both teams take an equal number of turns wins. If both teams meet this threshold, they tie. Print out the appropriate string based upon the results followed by a newline: - "cryptKickerFive won!" - "ghoulGang won!" - "It is a tie!"

This is it, the big night! Everything comes together here.

Variables:
– TrickOrTreater[] cryptKickerFive – array of length 5
– TrickOrTreater[] ghoulGang – array of length 5

Constructors:
– A constructor that takes in arrays for cryptKickerFive and ghoulGang (in this order).
– You may assume that each input array is not null, and that neither array has null entries. Further, you may assume that each input array is of the expected length. You may shallow copy these arrays.

Note: Even though this assignment guarantees each team will have five trick-or-treaters, do not hardcode the literal value 5 throughout this class. Write your code so that it would accommodate any pair of positive length arrays that share a length.

Methods:
– toString: To get a basic idea for the matchup, format a String representing HalloweenNight to this specification (no leading nor trailing whitespace, no angle brackets, no quotation marks, a single space following each colon and comma, and a single space preceding and following “versus”): versus ghoulGang: , , , ,
– Use the String representations defined for each trick-or-treater.
– Note: CKF represents the cryptKickerFive and GG represents the ghoulGang. The digit following the initials represents the index in the corresponding array.
– Note: It is acceptable to hardcode your format string to anticipate five members on each team for this method.

– compareTeams: Trick-or-treaters in each group could be off to a head start. Minding that, this method establishes rough criteria for which team begins at an advantage. Compare trick-or-treaters at matching indices of both teams (e.g., 0 and 0 ). The team with a higher count of greater trick-or-treaters is at an advantage. Print out the appropriate string based upon the conclusion followed by a newline:
– “cryptKickerFive is favored.”
– “ghoulGang is favored.”
– “Neither team is favored.”

– battle: This method takes in a positive int representing the winning candy threshold. A team’s total candy count must be at least this amount to win. If the input is nonpositive, default to 60. The instructions below describe the actions that a team should perform in one “turn”. Each trick-or-treater on the team will trick-or-treat. Following trick-or-treating, each ghost on the team will attempt to rob the trick-or-treater at the same index (e.g., 0 and 0) of the other team. Hint: Think of an operator that checks if a given reference has an “is-a” relationship with a class or interface. Although this HW defines only two specific kinds of trick-or-treaters, design your code to hold up even if there were more than two kinds. The battle should begin with the cryptKickerFive taking a turn. Each team must take at least one turn. The first team to meet the winning candy threshold after both teams take an equal number of turns wins. If both teams meet this threshold, they tie. Print out the appropriate string based upon the results followed by a newline:
– “cryptKickerFive won!”
– “ghoulGang won!”
– “It is a tie!”


 
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.

 
Instant
Download

Student review: (4 ratings) 4 out of 4 people found this solution helpful.