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