/* SkiJumper.java * CS207-2 Homework 7 Fall 2018 * This class represents a Ski Jumper in code. * * Add code to this class by implementing the interfaces * ITrainer and IAthlete such that the code in main() * executes providing the output shown in Problem 3. */ public class SkiJumper implements IAthlete, ITrainer { private String name; private double hours; private int nJumps; public SkiJumper(String name){ this.name=name; this.hours=0; this.nJumps=0; } public String getName(){ return this.name; } public int getNJumps(){ return this.nJumps; } public void jump(){ this.nJumps += 1; } @Override public void data(){ System.out.println("Name: "+this.name); System.out.println("Hours: "+this.hours); System.out.println("Number of jumps: "+this.nJumps); } @Override public void train(double h){ System.out.println("I am on slopes "+h+" hours today"); this.hours += h; } @Override public boolean equals(Object other) { boolean eq; if (other == null){ return false; } else if (this.getClass() != other.getClass()){ return false; } else{ SkiJumper sj = (SkiJumper) other; return this.nJumps == sj.getNJumps(); } } // End class SkiJumper }