Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi! I need the java code for this sheet please a picture for the UML diagram & the other 2 pictures are what should be

Hi!

I need the java code for this sheet please

a picture for the UML diagram & the other 2 pictures are what should be applied in the program

image text in transcribedimage text in transcribedimage text in transcribed

- The updateScore method should set the score of the team to the sum of all team players goals. - The change Player method takes the number of the player to get in and the number of the player to get out. It should check first that the substitutionCow did not reach the maxSubstitution, if so it should change the status of the player whose number is numberin to "playing" and the status of the player whose number is numberOur to "substitute" and return true. Otherwise, it retums false. - The getStrength method should compute the strength of the team as the average of the skill of its players. - The equals method should be overridden such that it returns true if two teams have the same strength and false otherwise. - The display Player Details method should print the details of all players in the team, by invoking the toString method. In the Player class: - The status data field is a string that has one of the following values: "playing", "substitute", and "suspended - The constructor should ask the user via input dialog messages to enter the name, status, number, and skill of the player. The cardsCount should be initialized to 0. - The increment Cards method should check that the cardsCount does not equal two. If so, it increments the cardsCount. Otherwise, it changes the status of the player to "suspended". - The toString method should be overridden such that it returns all the player details in an appropriate manner. For example: "Player name: number: In the Field Player class: - The scoreGoal method should increment the number of goals of the field player. The toString methods in the FieldPlayer and Goalkeeper classes should be overridden to return all details of the player, including those inherited from the super class. Good Luck Note the following: In the Match class: - The constructor should create objects for the hostTeam and guest Team - The display Result method should show the match result in a message dialog that includes the teams' names and their scores in the following order. host_team name host team_score: guest_team_name guest_team_score The following dialog box is an example: Message FC Barcelona 3:0 Bayern Munich OK - The displayBestScorer method should display the name of the player that scored the most in the match. The following dialog box is an example: Message Best Scorer: Lionel Messi OK In the Team class: - The constructor should create the array players with number of elements that equals the numberOfPlayers field. Then for each element in the array, it should ask the user via an input dialog box if the player to be created is a FieldPlayer or Goalkeeper, and create the object accordingly. The following is the input dialog box that should be displayed to the user when this constructor is invoked: Input What is the position of the player? 1.Field player 2.Goalkeeper OK Cancel Write a JAVA program to build an appropriate implementation for the UML diagram below, which models a football game, using the concepts of Object Oriented Programming that you learned. Match - hostTeam: Team guestTeam: Team + Match() + displayResult():void + displayBestScorer():void Team + name: String + score: int + players: Player() substitutionCount: int maxSubstitution int=3 - numberOfPlayerszint = 18 + Team() + updateScore(): void + change Player(numberIn:int, numberOut:int): boolean + getStrength():double + equals(o:Object): boolean displayPlayers Details(): void Player # name: String #status: String #number: int #cardsCount: int #skill: int + Player) + incrementCards(): void + toString():String Goalkeeper -numberOfSaves: int Field Player - goals: int + toString():String + getGoals():int + scorcGoal():void + toString(): String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions