Please follow each and every step in Java thx code for hikerunner…

Question Answered step-by-step Please follow each and every step in Java thx code for hikerunner… Image transcription textand set this hike ( the current The this Keyword 7 In setFavorite, fix the logic error using a two-way selectionhike ) as the favorite . Hide Let’s say you are an avid hiker and enjoy long treks through the Appalachian orRocky Mountains. You create a hiking app to keep track of some favorite hikes, always preferring l… Show more… Show morePlease follow each and every step in Java thx code for hikerunner/** Activity 2.5.6*/public class HikeRunner{ public static void main(String[] args) {   Hike hike1 = new Hike(“Cliff Ridge”, 3.6);   Hike hike2 = new Hike(“Apple Orchard”, 4);   hike1.setFavorite(hike2); }} /** Activity 2.5.6*/public class Hike{ private String name; private double miles; private Hike favorite; /**  * The constructor for the Hike class  */ public Hike(String n, double m) {   name = n;   miles = m;   favorite = null; }  /**  * Gets the favorite hike  *   * @return the favorite hike  */  public Hike getFavorite() {   return favorite; }  /**  * Sets and print out the longer hike as the favorite hike  *   * @param h The hike to compare hike lengths to  */ public void setFavorite(Hike h) {   if (h.miles > miles)   {     favorite = h;   }   System.out.println(“Favorite hike is ” + favorite); } /**  * Two hikes are equal if they have the same name and are length   *   * @param h The hike to compare this hike to  */ public boolean equals(Hike h) {   // check that s is defined   if (h != null)   {     if (h.name.equals(name) && h.miles == miles)     {       return true;     }   }   return false; } Hike.java code /**  * Return the name and length of the hike  *   * @return The hike’s name and lenght in miles  */ public String toString()  {   return name + ” (” + miles + ” miles)”; }} Thank you!! Ill give tip thru paypal 🙂 if u do it  Computer Science Engineering & Technology Java Programming CS 6096 Share QuestionEmailCopy link Comments (0)