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