Mercurial > hg > tweakathon2ios
diff Question.mm @ 0:a223551fdc1f
First commit - copy from tweakathlon.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 10 Oct 2014 11:46:42 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Question.mm Fri Oct 10 11:46:42 2014 +0100 @@ -0,0 +1,65 @@ +// +// Question.m +// sonicZoom +// +// Created by Robert Tubb on 21/01/2013. +// +// + +#import "Question.h" + +@implementation Question + +@synthesize questionText = _questionText; +@synthesize questionType = _questionType; +@synthesize answer = _answer; + +static int theCount = 0; +// WRONG +-(id)initWithTextAndType:(NSString *)text:(QuestionType)type{ + self = [super init]; + if(self){ + self.questionText = text; + self.questionType = type; + self.answer = -1; + } + + return self; + +} +//// +- (id)init +{ + return [self initWithTextAndType:@"Quo Vadis?":AGREE_DISAGREE]; +} + ++ (int) count { return theCount; } ++ (void) setCount:(int)c { theCount = c; } + + + ++(NSArray *)answersWithType:(QuestionType)type{ +// get the set of answers depending on what type the q was + // pseudo static variable + if(type == AGREE_DISAGREE){ + [Question setCount:NUM_CHOICES]; + + NSArray *answers = [[[NSArray alloc] initWithObjects: + @"Strongly agree",@"Agree", @"Neither agree nor disagree", + @"Disagree",@"Strongly disagree", nil] autorelease]; + + return answers; + + }else if(type == SLIDERS_ZOOMER){ + [Question setCount:NUM_CHOICES]; + NSArray *answers = [[[NSArray alloc] initWithObjects: + @"definitely the Sliders", @"maybe the Sliders", @"Neither/Both equal", + @"maybe the Zoomer", @"definitely the Zoomer", nil] autorelease]; + + return answers; + }else{ + return nil; + } +} +/// +@end