Question: Create a class named Athlete. The class has the following instance variables, constructors, and methods. Private instance variables name of type String, country of type
Create a class named Athlete. The class has the following instance variables, constructors, and methods.
Private instance variables name of type String, country of type String, age of type int, and medals of type int
A public empty noarg constructor
A public constructor that takes four arguments and sets the instance variables accordingly. Use the reference this in your implementation.
Public getter and setter methods for each of the instance variables country and medals. Use the reference this in the setter methods.
A public static method that takes two parameters of type Athlete and returns a boolean value. The method returns true if the instance variables age and medals of the first argument is equal to the instance variable age and medals of the second argument, respectively. The method's header is as follows:
public static boolean equalsAthlete a Athlete a
The method should also return true if a is equal to areference variable comparison
A public method named display that displays the instance variables of the invoking object in a format of your choice.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
