From f2e2ba19edb40a98c9ca0c5a15decc85993c09b3 Mon Sep 17 00:00:00 2001 From: Varindra Date: Tue, 30 Jun 2015 20:52:38 -0400 Subject: [PATCH] done --- .DS_Store | Bin 0 -> 6148 bytes TestAssessment/TestViewController.m | 102 ++++++++++++++++++++++++---- 2 files changed, 87 insertions(+), 15 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3973dfb3add9a3f134e5cb68fd638d38a804b258 GIT binary patch literal 6148 zcmeHKT}s115dOCIp`s6c?Bkw5=nZ0tC#VMy8&SlVpegv6b9fT3Azr|v_{|TcCHkO( zNSO&U-|l2)ll>Ml831XquI9iLz=SF|I;8nT{vMVhP*>bmP)kLuJH{7Ifprx3x dQi^9(75cLbh=pTsNDn1`1eAs_!N8v~@B#53M>+ri literal 0 HcmV?d00001 diff --git a/TestAssessment/TestViewController.m b/TestAssessment/TestViewController.m index 013428d..b0e00fa 100644 --- a/TestAssessment/TestViewController.m +++ b/TestAssessment/TestViewController.m @@ -18,30 +18,34 @@ @implementation TestViewController This method should return any positive NSInteger (hint: cannot be 0) */ -- (void)shouldReturnAPositiveNSInteger { - +- (NSInteger)shouldReturnAPositiveNSInteger { + NSInteger i = 10; + return i; } /* This method should return any negative CGFloat (hint: cannot be 0) */ -- (void)shouldReturnANegativeCGFloat { - +- (CGFloat)shouldReturnANegativeCGFloat { + CGFloat i; + i = -1.001; + return i; } /* 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 +53,11 @@ - (void)shouldReturnACharAtoZ { 0 - 99 using a loop (. 1 + 2 + 3 + ... + 98 + 99) */ - (NSInteger)shouldReturnSumOf0To100 { - return 0; + NSInteger sum=0; + for(int i =0; i<=99; i++){ + sum+=i; + } + return sum; } /* @@ -57,7 +65,12 @@ 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; + NSInteger sum=0; + for (int i =0; i1050){ + return 0; + } + int sum = arr[0]; + int holder = sum; + int i=1; + while(sum<=1050){ + holder=sum; + sum+=arr[i]; + i++; + } + return holder; return 0; }