rt300@0: // rt300@0: // Question.m rt300@0: // sonicZoom rt300@0: // rt300@0: // Created by Robert Tubb on 21/01/2013. rt300@0: // rt300@0: // rt300@0: rt300@0: #import "Question.h" rt300@0: rt300@0: @implementation Question rt300@0: rt300@0: @synthesize questionText = _questionText; rt300@0: @synthesize questionType = _questionType; rt300@0: @synthesize answer = _answer; rt300@0: rt300@0: static int theCount = 0; rt300@0: // WRONG rt300@0: -(id)initWithTextAndType:(NSString *)text:(QuestionType)type{ rt300@0: self = [super init]; rt300@0: if(self){ rt300@0: self.questionText = text; rt300@0: self.questionType = type; rt300@0: self.answer = -1; rt300@0: } rt300@0: rt300@0: return self; rt300@0: rt300@0: } rt300@0: //// rt300@0: - (id)init rt300@0: { rt300@0: return [self initWithTextAndType:@"Quo Vadis?":AGREE_DISAGREE]; rt300@0: } rt300@0: rt300@0: + (int) count { return theCount; } rt300@0: + (void) setCount:(int)c { theCount = c; } rt300@0: rt300@0: rt300@0: rt300@0: +(NSArray *)answersWithType:(QuestionType)type{ rt300@0: // get the set of answers depending on what type the q was rt300@0: // pseudo static variable rt300@0: if(type == AGREE_DISAGREE){ rt300@0: [Question setCount:NUM_CHOICES]; rt300@0: rt300@0: NSArray *answers = [[[NSArray alloc] initWithObjects: rt300@0: @"Strongly agree",@"Agree", @"Neither agree nor disagree", rt300@0: @"Disagree",@"Strongly disagree", nil] autorelease]; rt300@0: rt300@0: return answers; rt300@0: rt300@0: }else if(type == SLIDERS_ZOOMER){ rt300@0: [Question setCount:NUM_CHOICES]; rt300@0: NSArray *answers = [[[NSArray alloc] initWithObjects: rt300@0: @"definitely the Sliders", @"maybe the Sliders", @"Neither/Both equal", rt300@0: @"maybe the Zoomer", @"definitely the Zoomer", nil] autorelease]; rt300@0: rt300@0: return answers; rt300@0: }else{ rt300@0: return nil; rt300@0: } rt300@0: } rt300@0: /// rt300@0: @end