/* * 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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.