rt300@0
|
1 //
|
rt300@0
|
2 // Question.m
|
rt300@0
|
3 // sonicZoom
|
rt300@0
|
4 //
|
rt300@0
|
5 // Created by Robert Tubb on 21/01/2013.
|
rt300@0
|
6 //
|
rt300@0
|
7 //
|
rt300@0
|
8
|
rt300@0
|
9 #import "Question.h"
|
rt300@0
|
10
|
rt300@0
|
11 @implementation Question
|
rt300@0
|
12
|
rt300@0
|
13 @synthesize questionText = _questionText;
|
rt300@0
|
14 @synthesize questionType = _questionType;
|
rt300@0
|
15 @synthesize answer = _answer;
|
rt300@0
|
16
|
rt300@0
|
17 static int theCount = 0;
|
rt300@0
|
18 // WRONG
|
rt300@0
|
19 -(id)initWithTextAndType:(NSString *)text:(QuestionType)type{
|
rt300@0
|
20 self = [super init];
|
rt300@0
|
21 if(self){
|
rt300@0
|
22 self.questionText = text;
|
rt300@0
|
23 self.questionType = type;
|
rt300@0
|
24 self.answer = -1;
|
rt300@0
|
25 }
|
rt300@0
|
26
|
rt300@0
|
27 return self;
|
rt300@0
|
28
|
rt300@0
|
29 }
|
rt300@0
|
30 ////
|
rt300@0
|
31 - (id)init
|
rt300@0
|
32 {
|
rt300@0
|
33 return [self initWithTextAndType:@"Quo Vadis?":AGREE_DISAGREE];
|
rt300@0
|
34 }
|
rt300@0
|
35
|
rt300@0
|
36 + (int) count { return theCount; }
|
rt300@0
|
37 + (void) setCount:(int)c { theCount = c; }
|
rt300@0
|
38
|
rt300@0
|
39
|
rt300@0
|
40
|
rt300@0
|
41 +(NSArray *)answersWithType:(QuestionType)type{
|
rt300@0
|
42 // get the set of answers depending on what type the q was
|
rt300@0
|
43 // pseudo static variable
|
rt300@0
|
44 if(type == AGREE_DISAGREE){
|
rt300@0
|
45 [Question setCount:NUM_CHOICES];
|
rt300@0
|
46
|
rt300@0
|
47 NSArray *answers = [[[NSArray alloc] initWithObjects:
|
rt300@0
|
48 @"Strongly agree",@"Agree", @"Neither agree nor disagree",
|
rt300@0
|
49 @"Disagree",@"Strongly disagree", nil] autorelease];
|
rt300@0
|
50
|
rt300@0
|
51 return answers;
|
rt300@0
|
52
|
rt300@0
|
53 }else if(type == SLIDERS_ZOOMER){
|
rt300@0
|
54 [Question setCount:NUM_CHOICES];
|
rt300@0
|
55 NSArray *answers = [[[NSArray alloc] initWithObjects:
|
rt300@0
|
56 @"definitely the Sliders", @"maybe the Sliders", @"Neither/Both equal",
|
rt300@0
|
57 @"maybe the Zoomer", @"definitely the Zoomer", nil] autorelease];
|
rt300@0
|
58
|
rt300@0
|
59 return answers;
|
rt300@0
|
60 }else{
|
rt300@0
|
61 return nil;
|
rt300@0
|
62 }
|
rt300@0
|
63 }
|
rt300@0
|
64 ///
|
rt300@0
|
65 @end
|