Question: Objective and Overview: Exercise on User-defined classes. Homework maps to CLO-1 Exercise 1: (The Player class) Design a class named Player that contains a name

 Objective and Overview: Exercise on User-defined classes. Homework maps to CLO-1
Exercise 1: (The Player class) Design a class named Player that contains

Objective and Overview: Exercise on User-defined classes. Homework maps to CLO-1 Exercise 1: (The Player class) Design a class named Player that contains a name (String), a height (double), and three scores (array of int). 1. Create the class Player with all its attributes. Make all attributes private. 2. Create a default constructor for the class Player. 3. Create an initialization constructor for the class Player to initialize all attributes. 4. Create a copy constructor for the class Player 5. Create public accessors and mutators for all attributes of the class Player. 6. Create the toString() method in the class Player to return a string that represents all attributes inside the class. 7. Add a public method called equals to return true if two players are equal, and false otherwise. Two players are equal if they have the same name, height, and three scores. 8. Add a public compareTo() method to the class player to compare two players to each other. The players will compare by their names only. 9. Add a public method getAverageScore() in the class Player to return the average score for a player. 10. Create another class with a main method, call it TestPlayer. 11. In the main method, create a player p1 using the default constructor with name = "Salama", height =1.7, scores are [102,105, and 110]. (Hint: Use the setters and getter after you create the player with the default constructor] 12. Display the player p1 using its toString() method 13. Display the average score for the player p1 using the getAverageScore() method 14. Create another player p2 using the initialization constructor with name = "Mariam", height = 1.65, scores [79,85,92] 15. Display the player p2 using its toString() method 16. Display the total grade for the player p2 using the getAverageScore() method 17. Create a player p3 which is a copy of p2 (Hint: Use the copy constructor) and display it using the tostring() method 18. Open a file, called "players.txt" and read all lines in the file one by one. When reading a player info, create a Player object, and display it using its toString(). Assume that you do not know the total number of players in the file. (Hint: Use a while loop) 19. After reading all players, display the average of all players' average scores. 20. After reading all players, display the tallest player information using its toString() method. How to submit you Homework: 1. Create a Java project and call it HW1_YourName_YourTeamMemberName, for example: (HW2_Mona_Hoda) 2. Format all your files. 3. Run the test class and make sure that there are no syntax errors or runtime errors. 4. Document all your files by writing your names and IDs. All group members should write their names and IDs in the documentation part of every file. 5. Zip all of your project directory and submit the zipped file by attaching it to the assignment. 6. Please watch the vidco on how to create your proicet. 7. Please watch the video on how to submit your project

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!