Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given you have access to the following classes: ? A super class called Person wh

ID: 3629978 • Letter: G

Question

Given you have access to the following classes:
? A super class called Person which administers the following information:
? name, the name of the person.
? weight, a real number representing the weight of the person in kg.
? A class called License which administers information about a pilot's flying license.
You may assume that both of the above classes have already been developed, are available to you and have all the features and characteristics emphasised in the worksheet exercises.
Design a class called Pilot which is responsible for administering information about a pilot.
The Pilot class inherits from the Person class. In addition to the information administered by
the Person class the Pilot class is responsible for the following information:
? license, a License class object describing the information about a pilot's flying license.
Note that two Pilot objects are considered equal, if and only if, they have the same name, weight and license.
Your class should have all the features and characteristics emphasised in the worksheet
exercises.
answer question in a complete Java class

Explanation / Answer

// Design a class called Pilot which is responsible for administering information about a pilot.
// The Pilot class inherits from the Person class.
public class Pilot extends Person
{
// In addition to the information administered by the Person class the Pilot class is responsible for the following information: ? license, a License class object describing the information about a pilot's flying license.
private License license;

public Pilot(String name, double weight, License license)
{
super(name, weight); // pass name and weight to Person constructor
this.license = license;
}

// Note that two Pilot objects are considered equal, if and only if, they have the same name, weight and license.
public boolean equals(Object o)
{
Pilot rhs = (Pilot)o;
// check name and weight
if(!super.equals(rhs))
return false;
// check license
return license.equals(rhs.license);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote