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

/* * Declares the interface that the Driver class will use to interact with all

ID: 3538607 • Letter: #

Question

/*

* Declares the interface that the Driver class will use to interact with all types of participant.

*/

public interface Participant {

public abstract String getName();

public abstract Event getPreferredEvent();

public abstract boolean isDisqualified();

public abstract int performEvent(Event event, Distance distance) throws CouldNotFinishException;

public abstract void addTime(int additionalRaceTime);

public abstract void setCouldNotFinish();

public abstract int getTime() throws CouldNotFinishException;

}

Explanation / Answer

/*

* Declares the interface that the Driver class will use to interact with all types of participant.

* Save as Obj-C header file called 'Participant.h'

*/


@protocol Participant <NSObject>

@property(nonatomic, retain, readonly) NSString * name;

@property(nonatomic, retain, readonly) Event * preferredEvent;

@property(nonatomic, readonly) BOOL disqualified;

@property(nonatomic, readonly) int time;

- (int) performEvent:(Event *)event distance:(Distance *)distance;

- (void) addTime:(int)additionalRaceTime;

- (void) setCouldNotFinish;

@end