daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #import "PolygonShape.h"
  3.  
  4. - (void) computeAngleInDegrees: (int) numberOfSides;
  5.  
  6. @implementation PolygonShape
  7.  
  8. @synthesize numberOfSides;
  9. @synthesize minimumNumberOfSides;
  10. @synthesize maximumNumberOfSides;
  11.  
  12.  
  13. - (id) init
  14. {
  15.     [self initWithNumberOfSides:5 minimumNumberOfSides:3 maximumNumberOfSides:10];
  16.    
  17.     return self;
  18. }
  19.  
  20.  
  21. - (id) initWithNumberOfSides: (int) sides minimumNumberOfSides: (int) min maximumNumberOfSides:(int)max
  22. {
  23.     [self setMinimumNumberOfSides: min];
  24.     [self setMaximumNumberOfSides: max];
  25.     [self setNumberOfSides: sides];
  26.    
  27.     // compute angles
  28.     //[self computeAngleInDegrees];
  29.    
  30.     return self;
  31. }
  32.  
  33. - (void) setName : (NSString *name)
  34. {
  35.     self.name = name;
  36. }
  37.  
  38. - (void) setNumberOfSides: (int) numSides
  39. {
  40.     numberOfSides = numSides;
  41.     if(numberOfSides > maximumNumberOfSides || numberOfSides < minimumNumberOfSides)
  42.     {
  43.         numberOfSides = minimumNumberOfSides;
  44.     }
  45.     else
  46.     {
  47.         NSLog(@"There's an issue with the numberOfSides");
  48.     }
  49. }
  50.  
  51. - (void) setMinimumNumberOfSides: (int) minSides
  52. {
  53.     minimumNumberOfSides = minSides;
  54. }
  55.  
  56. - (void) setMaximumNumberOfSides: (int) maxSides
  57. {
  58.     maximumNumberOfSides = maxSides;
  59. }
  60.  
  61. - (float) angleInDegrees: (float) degrees
  62. {
  63.     return angleInDegrees;
  64. }
  65.  
  66. - (void) computeAngleInDegrees: (int) numberOfSides
  67. {
  68.     self.angleInDegrees = (180 * (numberOfSides - 2)) / numberOfSides;
  69. }
  70.  
  71. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top