From 527890337873f7841e564f656e06e574a01a483d Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 30 Jun 2015 21:37:44 -0400 Subject: [PATCH] I finished! --- TestAssessment/Person.h | 1 + TestAssessment/TestViewController.m | 107 ++++++++++++++++++++++------ 2 files changed, 85 insertions(+), 23 deletions(-) diff --git a/TestAssessment/Person.h b/TestAssessment/Person.h index d331757..96e3c94 100644 --- a/TestAssessment/Person.h +++ b/TestAssessment/Person.h @@ -15,6 +15,7 @@ - (void)setName:(NSString *)name; - (NSString *)name; + - (void)setAge:(NSInteger)age; - (NSInteger)age; diff --git a/TestAssessment/TestViewController.m b/TestAssessment/TestViewController.m index 013428d..683fe17 100644 --- a/TestAssessment/TestViewController.m +++ b/TestAssessment/TestViewController.m @@ -18,7 +18,8 @@ @implementation TestViewController This method should return any positive NSInteger (hint: cannot be 0) */ -- (void)shouldReturnAPositiveNSInteger { +- (NSInteger)shouldReturnAPositiveNSInteger { + return 22; } @@ -26,22 +27,24 @@ - (void)shouldReturnAPositiveNSInteger { This method should return any negative CGFloat (hint: cannot be 0) */ -- (void)shouldReturnANegativeCGFloat { - +- (CGFloat)shouldReturnANegativeCGFloat { + float negativeF = -2.66f; + return negativeF; } /* This method should return a falsy boolean Falsey: Something which evaluates to FALSE. */ -- (void)shouldReturnAFalseyBool { - +- (BOOL)shouldReturnAFalseyBool { + return NO; } /* This method should return a single char from a - z */ -- (void)shouldReturnACharAtoZ { +- (char)shouldReturnACharAtoZ { + return 'a'; } /* @@ -49,7 +52,11 @@ - (void)shouldReturnACharAtoZ { 0 - 99 using a loop (. 1 + 2 + 3 + ... + 98 + 99) */ - (NSInteger)shouldReturnSumOf0To100 { - return 0; + int sum=0; + for (int i=0; i<100; i++){ + sum = sum+i; + } + return sum; } /* @@ -57,7 +64,11 @@ Given a c array (int[]) and a count, return the sum of the numbers within the ar (eg. arr[0] + arr[1] ...) */ - (NSInteger)shouldReturnSumOfArrayValues:(int *)arr withSize:(int)count { - return 0; + int sumOfArrayValues = 0; + for (int i=0; i= 1050) + break; + else + i++; + } + sum = sum - arr[i]; + return sum; } - @end