From 2992ad3b6a67b86aeb6b725780d2169758aac1ab Mon Sep 17 00:00:00 2001 From: ayunav Date: Sat, 27 Jun 2015 10:52:49 -0400 Subject: [PATCH 01/19] changed created by line --- TodoList/TodoList/main.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 187be40..62fd100 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -2,7 +2,7 @@ // main.m // TodoList // -// Created by Michael Kavouras on 6/25/15. +// Created by Ayuna Vogel πŸ‡·πŸ‡ΊπŸ‡ΊπŸ‡Έ {{ in πŸ’› with πŸš• city }} on 6/25/15. // Copyright (c) 2015 Mike Kavouras. All rights reserved. // From a2a47cb855fec28b64c8d9570520570beba8cae7 Mon Sep 17 00:00:00 2001 From: ayunav Date: Sat, 27 Jun 2015 10:57:31 -0400 Subject: [PATCH 02/19] changed created by text --- TodoList/TodoList/main.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 62fd100..a49b0a7 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -2,7 +2,7 @@ // main.m // TodoList // -// Created by Ayuna Vogel πŸ‡·πŸ‡ΊπŸ‡ΊπŸ‡Έ {{ in πŸ’› with πŸš• city }} on 6/25/15. +// Created by Zoufishan Mehdi and Ayuna Vogel πŸ‡·πŸ‡ΊπŸ‡ΊπŸ‡Έ {{ in πŸ’› with πŸš• city }} on 6/25/15. // Copyright (c) 2015 Mike Kavouras. All rights reserved. // From cd99c5e9ce506d2c4dd084d5bc4f24bd9e6d3408 Mon Sep 17 00:00:00 2001 From: Zoufishan Mehdi Date: Sat, 27 Jun 2015 13:08:12 -0400 Subject: [PATCH 03/19] first joint commit from Zouf's PC --- TodoList/TodoList.xcodeproj/project.pbxproj | 1 + TodoList/TodoList/main.m | 60 ++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/TodoList/TodoList.xcodeproj/project.pbxproj b/TodoList/TodoList.xcodeproj/project.pbxproj index 17baea5..8057c4f 100644 --- a/TodoList/TodoList.xcodeproj/project.pbxproj +++ b/TodoList/TodoList.xcodeproj/project.pbxproj @@ -235,6 +235,7 @@ 8D9789FC1B3C9A7F007CF4CF /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index a49b0a7..429844d 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -7,11 +7,67 @@ // #import +//********************** INTERFACE TO DO APP ********* +@interface ToDoApp : NSObject + +@end + +//*********************** INTERFACE TODO LIST ****** +@interface ToDoList : NSObject + +-(void)displayItems:(NSArray*)displayItems; + +-(void)addItem:(NSArray*)add; +-(NSArray *)add; + +-(void)removeItem:(NSArray*)remove; +-(NSArray *)remove; + +-(void)markItem:(NSArray*)mark; +-(NSArray *)mark; + +-(void)listCompletedItems; + +@end + +//************************INTERFACE TODO ITEM +@interface ToDoItem : NSObject + +-(void)setItemName:(NSString *)itemName; +-(NSString *)itemName; + +-(int)setPriority:(int)priority; + +@end + + +//*************** IMPLEM TO DO APP *************** +//@implementation +//@end + + + +//*************** IMPLEM TO DO LIST *************** +@implementation ToDoList { + NSString *_name; + NSMutableArray *_listOfItems; +} +@end + + + +//*************** IMPLEM TO DO ITEM *************** +@implementation ToDoItem { + NSString *_itemName; + NSInteger priority; +} +@end + + int main(int argc, const char * argv[]) { @autoreleasepool { - // insert code here... - NSLog(@"Hello, World!"); + } return 0; } From f9efefc638c56de46e9a96d2da38308bd72f67b0 Mon Sep 17 00:00:00 2001 From: Zoufishan Mehdi Date: Sat, 27 Jun 2015 14:41:43 -0400 Subject: [PATCH 04/19] changes --- TodoList/TodoList/main.m | 73 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 429844d..961adcf 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -10,6 +10,19 @@ //********************** INTERFACE TO DO APP ********* @interface ToDoApp : NSObject +-(void)displayLists:(NSArray*)displayLists; +-(NSArray *)displayLists; + +-(void)addList:(NSArray*)addList; +-(NSArray *)addList; + +-(void)removeList:(NSArray*)removeList; +-(NSArray *)removeList; + +-(void)renameList:(NSArray*)renameList; +-(NSArray *)renameList; + + @end //*********************** INTERFACE TODO LIST ****** @@ -36,22 +49,59 @@ @interface ToDoItem : NSObject -(void)setItemName:(NSString *)itemName; -(NSString *)itemName; --(int)setPriority:(int)priority; +-(void)setPriority:(int)priority; +-(int *)priority; @end //*************** IMPLEM TO DO APP *************** -//@implementation -//@end +@implementation ToDoApp { + NSMutableArray *_allLists; +} + +-(void)displayLists:(NSArray*)displayLists { + for(ToDoApp *something in _allLists) { + printf("%s\n", [[something description] UTF8String]); + } +} +//-(NSArray *)displayLists { +// return _displayLists; +//} + +-(void)addList:(NSArray*)addList { + +} +-(NSArray *)addList { + +} + +-(void)removeList:(NSArray*)removeList { + +} +-(NSArray *)removeList { + +} + +-(void)renameList:(NSArray*)renameList { + +} + +-(NSArray *)renameList { + +} + + +@end //*************** IMPLEM TO DO LIST *************** @implementation ToDoList { - NSString *_name; + NSString *_listName; NSMutableArray *_listOfItems; } + @end @@ -61,6 +111,19 @@ @implementation ToDoItem { NSString *_itemName; NSInteger priority; } + + +-(void)setItemName:(NSString *)itemName { + _itemName = itemName; +} +-(NSString *)itemName; + +-(void)setPriority:(int)priority { + _priority = priority; + +} +-(int *)priority; + @end @@ -68,6 +131,8 @@ @implementation ToDoItem { int main(int argc, const char * argv[]) { @autoreleasepool { + + } return 0; } From 1dbc1241ddf3c931dceff14642487c2c432137e0 Mon Sep 17 00:00:00 2001 From: ayunav Date: Sat, 27 Jun 2015 15:15:11 -0400 Subject: [PATCH 05/19] third commit to a new branch under ayuna --- TodoList/TodoList/main.m | 103 ++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 39 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 961adcf..45810d6 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -10,16 +10,16 @@ //********************** INTERFACE TO DO APP ********* @interface ToDoApp : NSObject --(void)displayLists:(NSArray*)displayLists; +-(void)displayLists:(NSMutableArray*)displayLists; -(NSArray *)displayLists; --(void)addList:(NSArray*)addList; +-(void)addList:(NSMutableArray*)addList; -(NSArray *)addList; --(void)removeList:(NSArray*)removeList; +-(void)removeList:(NSMutableArray*)removeList; -(NSArray *)removeList; --(void)renameList:(NSArray*)renameList; +-(void)renameList:(NSMutableArray*)renameList; -(NSArray *)renameList; @@ -28,18 +28,18 @@ -(NSArray *)renameList; //*********************** INTERFACE TODO LIST ****** @interface ToDoList : NSObject --(void)displayItems:(NSArray*)displayItems; +-(void)displayItems:(NSMutableArray*)displayItems; --(void)addItem:(NSArray*)add; +-(void)addItem:(NSMutableArray*)add; -(NSArray *)add; --(void)removeItem:(NSArray*)remove; +-(void)removeItem:(NSMutableArray*)remove; -(NSArray *)remove; --(void)markItem:(NSArray*)mark; +-(void)markItem:(NSMutableArray*)mark; -(NSArray *)mark; --(void)listCompletedItems; +-(void)listCompletedItems:(NSMutableArray*)listCompletedItems; @end @@ -60,36 +60,36 @@ @implementation ToDoApp { NSMutableArray *_allLists; } --(void)displayLists:(NSArray*)displayLists { +-(void)displayLists:(NSMutableArray*)displayLists { for(ToDoApp *something in _allLists) { printf("%s\n", [[something description] UTF8String]); } } -//-(NSArray *)displayLists { +//-(NSMutableArray *)displayLists { // return _displayLists; //} --(void)addList:(NSArray*)addList { - -} --(NSArray *)addList { - -} - --(void)removeList:(NSArray*)removeList { - -} --(NSArray *)removeList { - -} - --(void)renameList:(NSArray*)renameList { - -} - --(NSArray *)renameList { - -} +//-(void)addList:(NSMutableArray*)addList { +// +//} +//-(NSMutableArray *)addList { +// +//} +// +//-(void)removeList:(NSMutableArray*)removeList { +// +//} +//-(NSMutableArray *)removeList { +// +//} +// +//-(void)renameList:(NSMutableArray*)renameList { +// +//} +// +//-(NSMutableArray *)renameList { +// +//} @end @@ -101,6 +101,26 @@ @implementation ToDoList { NSString *_listName; NSMutableArray *_listOfItems; } +-(void)displayItems:(NSMutableArray*)displayItems { + for(ToDoList *listOfItems in _listOfItems) { + printf("%s\n", [[listOfItems description] UTF8String]); + } +} +-(void)listCompletedItems:(NSMutableArray*)listCompletedItems { + for(ToDoList *listOfCompletedItems in _listOfItems) { + printf("%s\n", [[listCompletedItems description] UTF8String]); + } +} +-(void)addItem:(NSArray*)add { + +} +-(NSArray *)add; + +-(void)removeItem:(NSArray*)remove; +-(NSArray *)remove; + +-(void)markItem:(NSArray*)mark; +-(NSArray *)mark; @end @@ -109,27 +129,32 @@ @implementation ToDoList { //*************** IMPLEM TO DO ITEM *************** @implementation ToDoItem { NSString *_itemName; - NSInteger priority; + NSInteger *_priority; } - -(void)setItemName:(NSString *)itemName { _itemName = itemName; + NSLog(@"%@", itemName); +} +-(NSString *)itemName { + return _itemName; } --(NSString *)itemName; --(void)setPriority:(int)priority { +-(void)setPriority:(int) priority { _priority = priority; - } --(int *)priority; +-(int *)priority { + return _priority; +} @end - +//***************** MAIN FUNCTION *********************** int main(int argc, const char * argv[]) { @autoreleasepool { + ToDoItem *homework = [[ToDoItem alloc] init]; + [homework setItemName:@"Study Git branching"]; From afd952ade749282440652012ab637a378f6d3774 Mon Sep 17 00:00:00 2001 From: ayunav Date: Sat, 27 Jun 2015 15:34:29 -0400 Subject: [PATCH 06/19] commit to practice --- TodoList/TodoList/main.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 45810d6..44fd99b 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -6,6 +6,8 @@ // Copyright (c) 2015 Mike Kavouras. All rights reserved. // +//I'll just type this to practice, Zouf, you have to delete it later to practice, too! :) ' + #import //********************** INTERFACE TO DO APP ********* @interface ToDoApp : NSObject From 06df8e5b45790a744f2a9ff10fd3e929f5268182 Mon Sep 17 00:00:00 2001 From: ayunav Date: Sat, 27 Jun 2015 16:07:40 -0400 Subject: [PATCH 07/19] added add new item method --- TodoList/TodoList/main.m | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 44fd99b..aa17dd1 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -32,14 +32,13 @@ @interface ToDoList : NSObject -(void)displayItems:(NSMutableArray*)displayItems; --(void)addItem:(NSMutableArray*)add; --(NSArray *)add; +-(NSString*)addItem:(NSString*)newItemName; --(void)removeItem:(NSMutableArray*)remove; --(NSArray *)remove; +-(void)removeItem:(NSString*)remove; +-(NSString *)remove; --(void)markItem:(NSMutableArray*)mark; --(NSArray *)mark; +-(void)markItem:(NSString*)mark; +-(NSString *)mark; -(void)listCompletedItems:(NSMutableArray*)listCompletedItems; @@ -113,16 +112,18 @@ -(void)listCompletedItems:(NSMutableArray*)listCompletedItems { printf("%s\n", [[listCompletedItems description] UTF8String]); } } --(void)addItem:(NSArray*)add { - +-(NSString*)addItem:(NSString*)newItemName { + ToDoItem *newItem = [[ToDoItem alloc]init]; + [newItem setItemName:newItemName]; + [_listOfItems addObject:newItemName]; + return newItemName; } --(NSArray *)add; --(void)removeItem:(NSArray*)remove; --(NSArray *)remove; +-(void)removeItem:(NSString*)remove; +-(NSString *)remove; --(void)markItem:(NSArray*)mark; --(NSArray *)mark; +-(void)markItem:(NSString*)mark; +-(NSString *)mark; @end From 376cb613d272d5f3636d7b608dd1351db57d0c78 Mon Sep 17 00:00:00 2001 From: Zoufishan Mehdi Date: Sun, 28 Jun 2015 10:24:45 -0400 Subject: [PATCH 08/19] last Saturday changes --- TodoList/TodoList/main.m | 125 +++++++++++++++++++++++++++++++-------- unit-0-assessment | 1 + 2 files changed, 100 insertions(+), 26 deletions(-) create mode 160000 unit-0-assessment diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index aa17dd1..9d52807 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -6,9 +6,12 @@ // Copyright (c) 2015 Mike Kavouras. All rights reserved. // -//I'll just type this to practice, Zouf, you have to delete it later to practice, too! :) ' - #import + +@class ToDoApp; +@class ToDoList; +@class ToDoItem; + //********************** INTERFACE TO DO APP ********* @interface ToDoApp : NSObject @@ -34,15 +37,15 @@ -(void)displayItems:(NSMutableArray*)displayItems; -(NSString*)addItem:(NSString*)newItemName; --(void)removeItem:(NSString*)remove; --(NSString *)remove; - --(void)markItem:(NSString*)mark; --(NSString *)mark; - --(void)listCompletedItems:(NSMutableArray*)listCompletedItems; - -@end +//-(void)removeItem:(NSString*)remove; +//-(NSString *)remove; +// +//-(void)markItem:(NSString*)mark; +//-(NSString *)mark; +// +//-(void)listCompletedItems:(NSMutableArray*)listCompletedItems; +// +//@end //************************INTERFACE TODO ITEM @interface ToDoItem : NSObject @@ -57,14 +60,14 @@ -(int *)priority; //*************** IMPLEM TO DO APP *************** -@implementation ToDoApp { - NSMutableArray *_allLists; -} - --(void)displayLists:(NSMutableArray*)displayLists { - for(ToDoApp *something in _allLists) { - printf("%s\n", [[something description] UTF8String]); - } +//@implementation ToDoApp { +// NSMutableArray *_allLists; +//} +// +//-(void)displayLists:(NSMutableArray*)displayLists { +// for(ToDoApp *something in _allLists) { +// printf("%s\n", [[something description] UTF8String]); +// } } //-(NSMutableArray *)displayLists { // return _displayLists; @@ -113,17 +116,27 @@ -(void)listCompletedItems:(NSMutableArray*)listCompletedItems { } } -(NSString*)addItem:(NSString*)newItemName { - ToDoItem *newItem = [[ToDoItem alloc]init]; - [newItem setItemName:newItemName]; - [_listOfItems addObject:newItemName]; - return newItemName; + scanf("%s", &newItemName); + +// +// ToDoItem *newItem = [[ToDoItem alloc]init]; +// [newItem setItemName:newItemName]; +// [_listOfItems addObject:newItemName]; +// return newItemName; +} + +-(void)renameList:(NSString*) name{ + _listName = name; } + -(void)removeItem:(NSString*)remove; --(NSString *)remove; +//-(NSString *)remove; + +//-(void)markItem:(NSString*)mark { +////-(NSString *)mark; +//} --(void)markItem:(NSString*)mark; --(NSString *)mark; @end @@ -157,10 +170,70 @@ -(int *)priority { int main(int argc, const char * argv[]) { @autoreleasepool { ToDoItem *homework = [[ToDoItem alloc] init]; + ToDoList *list1 = [[ToDoList alloc] init]; + [homework setItemName:@"Study Git branching"]; + int createListYesNo; + printf("Would you like to create a to-do list? \n 0)No 1)Yes \n"); + scanf("%d", &createListYesNo); + + if (createListYesNo == 0) { + return 0; + } else { + NSString *listName; + printf("Enter a name for your to-do list \n"); + scanf("%s", &listName); + [list1 renameList:listName]; + + } + + + +// +// int enterOrRun; +// printf("Will I beat superman?, \n 0) I'm ready to defeat superman \n 1) I would rather for my life while I can \n"); +// scanf("%d", &enterOrRun); +// +// //Enter the fork in the road: Batman & Kryptonite +// +// if (enterOrRun == 0) { +// int batmanVsKryptonite; +// printf("Which path do you choose: Goddamned Batman or Kryptonite? \n 0)Batman, here we go! \n 1) Batwhat? I will go with Kryptonite \n"); +// scanf("%d", &batmanVsKryptonite); +// //You choose Batman +// if (batmanVsKryptonite == 0) { +// int batOrNot; +// printf("Am I the Goddamned Batman? \n 0)Why yes! I also have batwings \n 1) Definitely not! Can I pretend though? \n"); +// scanf("%d", &batOrNot); +// //You are batman +// if ((batOrNot == 0) && batwings){ +// printf("Maybe, once. On a good day."); +// //You are not batman +// } else { +// printf("No. You lose HORRIBLY!"); +// } +// + + //Arrays +// NSMutableArray *myArray = [[NSMutableArray alloc] init]; +// NSArray *array = [[[NSArray alloc]] initWithObjects:@"one", +// @"two", nil]; + + // Person *person = [[Person alloc] init]; +// [myArray addObject:[person name]]; +// [[myArray firstObject] danceInTheRain]; +// +// +// [myArray addObject:@"mike"]; +// NSString *name = @"mike"; +// [name length]; +// +// NSString *myName = [myArray firstObject]; +// [myName length]; + } return 0; } diff --git a/unit-0-assessment b/unit-0-assessment new file mode 160000 index 0000000..70549bd --- /dev/null +++ b/unit-0-assessment @@ -0,0 +1 @@ +Subproject commit 70549bd8f68215e89b1c886a1723c3addc43f99f From de857fa239d0173aba8c1365ef93954c278e89fd Mon Sep 17 00:00:00 2001 From: ayunav Date: Sun, 28 Jun 2015 10:29:56 -0400 Subject: [PATCH 09/19] github push to check --- TodoList/TodoList/main.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 9d52807..f5ec7a6 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -6,6 +6,9 @@ // Copyright (c) 2015 Mike Kavouras. All rights reserved. // +//checking push for github - Ayuna + + #import @class ToDoApp; From ffdea6db613c04e28ca3864ff035a8d64bd388ed Mon Sep 17 00:00:00 2001 From: ayunav Date: Wed, 1 Jul 2015 22:30:00 -0400 Subject: [PATCH 10/19] commit for final pull request --- TodoList/TodoList.xcodeproj/project.pbxproj | 18 ++ TodoList/TodoList/Item.h | 27 ++ TodoList/TodoList/Item.m | 52 ++++ TodoList/TodoList/List.h | 29 ++ TodoList/TodoList/List.m | 176 +++++++++++ TodoList/TodoList/ListManager.h | 25 ++ TodoList/TodoList/ListManager.m | 120 ++++++++ TodoList/TodoList/main.m | 313 ++++++-------------- unit-0-assessment | 1 - 9 files changed, 531 insertions(+), 230 deletions(-) create mode 100644 TodoList/TodoList/Item.h create mode 100644 TodoList/TodoList/Item.m create mode 100644 TodoList/TodoList/List.h create mode 100644 TodoList/TodoList/List.m create mode 100644 TodoList/TodoList/ListManager.h create mode 100644 TodoList/TodoList/ListManager.m delete mode 160000 unit-0-assessment diff --git a/TodoList/TodoList.xcodeproj/project.pbxproj b/TodoList/TodoList.xcodeproj/project.pbxproj index 8057c4f..f3729b6 100644 --- a/TodoList/TodoList.xcodeproj/project.pbxproj +++ b/TodoList/TodoList.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 29DC02311B44D98300C3F5B7 /* Item.m in Sources */ = {isa = PBXBuildFile; fileRef = 29DC022C1B44D98300C3F5B7 /* Item.m */; }; + 29DC02321B44D98300C3F5B7 /* List.m in Sources */ = {isa = PBXBuildFile; fileRef = 29DC022E1B44D98300C3F5B7 /* List.m */; }; + 29DC02331B44D98300C3F5B7 /* ListManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 29DC02301B44D98300C3F5B7 /* ListManager.m */; }; 8D9789F71B3C9A7F007CF4CF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D9789F61B3C9A7F007CF4CF /* main.m */; }; /* End PBXBuildFile section */ @@ -23,6 +26,12 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 29DC022B1B44D98300C3F5B7 /* Item.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Item.h; sourceTree = ""; }; + 29DC022C1B44D98300C3F5B7 /* Item.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Item.m; sourceTree = ""; }; + 29DC022D1B44D98300C3F5B7 /* List.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = List.h; sourceTree = ""; }; + 29DC022E1B44D98300C3F5B7 /* List.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = List.m; sourceTree = ""; }; + 29DC022F1B44D98300C3F5B7 /* ListManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListManager.h; sourceTree = ""; }; + 29DC02301B44D98300C3F5B7 /* ListManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListManager.m; sourceTree = ""; }; 8D9789F31B3C9A7F007CF4CF /* TodoList */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TodoList; sourceTree = BUILT_PRODUCTS_DIR; }; 8D9789F61B3C9A7F007CF4CF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -58,6 +67,12 @@ isa = PBXGroup; children = ( 8D9789F61B3C9A7F007CF4CF /* main.m */, + 29DC022B1B44D98300C3F5B7 /* Item.h */, + 29DC022C1B44D98300C3F5B7 /* Item.m */, + 29DC022D1B44D98300C3F5B7 /* List.h */, + 29DC022E1B44D98300C3F5B7 /* List.m */, + 29DC022F1B44D98300C3F5B7 /* ListManager.h */, + 29DC02301B44D98300C3F5B7 /* ListManager.m */, ); path = TodoList; sourceTree = ""; @@ -118,7 +133,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 29DC02321B44D98300C3F5B7 /* List.m in Sources */, + 29DC02311B44D98300C3F5B7 /* Item.m in Sources */, 8D9789F71B3C9A7F007CF4CF /* main.m in Sources */, + 29DC02331B44D98300C3F5B7 /* ListManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TodoList/TodoList/Item.h b/TodoList/TodoList/Item.h new file mode 100644 index 0000000..9cbdc8b --- /dev/null +++ b/TodoList/TodoList/Item.h @@ -0,0 +1,27 @@ +// +// Item.h +// toDoListFromScratchZoufAndAyuna +// +// Created by Ayuna Vogel on 6/30/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. +// + +#import +#import "Item.h" +#import "List.h" +#import "ListManager.h" + +@class ListManager; +@class List; +@class Item; + +@interface Item : NSObject +-(void) setItem: (NSString *) item; +-(void) addItemDescription; +-(void) setItemPriority: (int) itemPriority; +-(NSString*) itemName; +-(int) itemPriority; +-(BOOL) markedDone; +-(void) setMarkedDone:(BOOL)markedDone; + +@end diff --git a/TodoList/TodoList/Item.m b/TodoList/TodoList/Item.m new file mode 100644 index 0000000..d5d8eac --- /dev/null +++ b/TodoList/TodoList/Item.m @@ -0,0 +1,52 @@ +// +// Item.m +// toDoListFromScratchZoufAndAyuna +// +// Created by Ayuna Vogel on 6/30/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. +// + +#import "Item.h" + +@implementation Item { + + NSString* _itemName; + int _itemPriority; + BOOL _markedDone; +} + +-(void) setItem: (NSString *) item { + _itemName = item; +} + +-(void) addItemDescription { + NSLog(@"Enter task description: "); + // fgets method allows user to input more than one word ie: "finish project" + char itemInput[256]; + fgets(itemInput, 256, stdin); + // NSLog(@"item added: %s", name); // we test our work above here + NSString *itemDescription = [NSString stringWithUTF8String:itemInput]; //stringWithUTF8String converts char to string + // NSLog(@"string test: %@", item1); + [self setItem: itemDescription]; +} + +-(NSString*) itemName { + return _itemName; +} + +-(void) setItemPriority: (int) itemPriority { + _itemPriority = itemPriority; +} + +-(int) itemPriority { + return _itemPriority; +} +-(void) setMarkedDone:(BOOL)markedDone { + _markedDone = markedDone; +} + +-(BOOL) markedDone { + return _markedDone; +} + +@end diff --git a/TodoList/TodoList/List.h b/TodoList/TodoList/List.h new file mode 100644 index 0000000..110f92c --- /dev/null +++ b/TodoList/TodoList/List.h @@ -0,0 +1,29 @@ +// +// List.h +// toDoListFromScratchZoufAndAyuna +// +// Created by Ayuna Vogel on 6/30/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. +// + +#import +#import "Item.h" +#import "List.h" +#import "ListManager.h" + +@class ListManager; +@class List; +@class Item; + +@interface List : NSObject +-(void)setListName: (NSString *) listName; +-(NSString *) listName; +-(NSMutableArray *) itemsInList; +-(void) addItemToList: (Item *) task; +-(void) deleteItemFromList; +-(void) printAllItemsInList; +-(void) markItemDone: (Item *) task; +//-(void) editItemName; +-(void) listOptions; +-(void) addListDescription; +@end \ No newline at end of file diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m new file mode 100644 index 0000000..00df98d --- /dev/null +++ b/TodoList/TodoList/List.m @@ -0,0 +1,176 @@ +// +// List.m +// toDoListFromScratchZoufAndAyuna +// +// Created by Ayuna Vogel on 6/30/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. +// + +#import "List.h" + +@implementation List { + NSString* _listName; + NSMutableArray* _itemsInList; +} + +-(void)setListName:(NSString *)listName { + _listName = listName; +} +-(NSString*) listName { + return _listName; +} +-(NSMutableArray*)itemsInList { + if (_itemsInList == nil) { + _itemsInList = [[NSMutableArray alloc] init]; + } + return _itemsInList; +} + +-(void) addItemToList: (Item*) task { + [_itemsInList addObject:task]; +} +-(void) deleteItemFromList { + NSLog(@"Enter a number to delete task"); + int j; + scanf("%d", &j); + for (int i = 0; i < [_itemsInList count]; i++) { + if (i == j) { + [_itemsInList removeObjectAtIndex:j-1]; + } + } +} + +-(void) printAllItemsInList { + for (int i = 0; i < [_itemsInList count]; i++) { + NSString *itemName = [[_itemsInList objectAtIndex:i] itemName]; + int itemPriority = [[_itemsInList objectAtIndex:i] itemPriority]; + NSLog(@"%i %@, %d", i+1, itemName, itemPriority); + } +} + +-(void) printAllCompletedItems:(BOOL) value { + for (int i = 0; i < [_itemsInList count]; i++) { + if ([[_itemsInList objectAtIndex:i] markedDone] == value) { + NSString *itemName = [[_itemsInList objectAtIndex:i] itemName]; + int itemPriority = [[_itemsInList objectAtIndex:i] itemPriority]; + NSLog(@"%i %@, %d", i+1, itemName, itemPriority); + } + } +} + +-(void) markItemDone: (Item *) task { + NSLog(@"Enter a number to mark task done"); + int j; + scanf("%d", &j); + for (int i = 0; i < [_itemsInList count]; i++) { + if (i == j) { + NSString *task = [[_itemsInList objectAtIndex:j-1] itemName]; + NSString *printTaskAsCompleted = [NSString stringWithFormat:@"βœ”οΈŽ %i %@", i, task]; + [[_itemsInList objectAtIndex:j-1] setMarkedDone:YES]; + NSLog(@"%@", printTaskAsCompleted); + } + } +} + +-(void) editItemName { + //print the list of items in this list + NSLog(@"Enter a number to pick a task to edit"); +// first version of this code - doesn't work +// NSLog(@"Enter task description"); +// char newItemName[256]; +// fgets(newItemName, 256, stdin); +// NSString *editedItemName = [NSString stringWithUTF8String:newItemName]; + +//2nd version: + //if scanf user input = edit task { +// int j; +// scanf("%d", &j); +// for (int i = 0; i < [_itemsInList count]; i++) { +// if (j == i) { +// NSString *itemName = [[_itemsInList objectAtIndex:j-1] itemName]; +// NSLog(@"Enter task description"); +// char newItemName[256]; +// fgets(newItemName, 256, stdin); +// NSString *editedItemName = [NSString stringWithUTF8String:newItemName]; +// itemName = editedItemName; +// } +// } +} + +-(void) addListDescription { + NSLog(@"Enter list description: "); + // fgets method allows user to input more than one word ie: "finish project" + char listDescriptionInput[256]; + fgets(listDescriptionInput, 256, stdin); + // NSLog(@"item added: %s", name); // we test our work above here + NSString *listDescription = [NSString stringWithUTF8String:listDescriptionInput]; //stringWithUTF8String converts char to string + // NSLog(@"string test: %@", item1); + [self setListName:listDescription]; +} + +-(void) listOptions { + int i; + BOOL runListOptionsMenu = true; + while (runListOptionsMenu) { + + NSArray *listOptions = [[NSArray alloc] initWithObjects:@"1 - Display all tasks", @"2 - Add new task", @"3 - Edit task", @"4 - Delete task", @"5 - Mark task done", @"6 - List all active tasks", @"7 - List completed tasks", @"0 - Quit", nil]; + + NSLog(@"%@", listOptions); + scanf("%d", &i); + fpurge(stdin); + + if (i == 1) { + //print all items in list + [self printAllItemsInList]; + } + if (i == 2) { + //add new item + [self printAllItemsInList]; + NSLog(@"Enter a list number to add an item to"); + int i; + scanf("%d", &i); + // [self addItemToList:<#(Item *)#>:i]; + } + if (i == 3) { + //rename item + [self printAllItemsInList]; + NSLog(@"Enter an item number to rename it"); + int i; + scanf("%d", &i); + [self editItemName]; + } + if (i == 4) { + //delete item + [self printAllItemsInList]; + NSLog(@"Enter an item number to delete it"); + int i; + scanf("%d", &i); + [self deleteItemFromList]; + } + if (i == 5) { + //mark task done + [self printAllItemsInList]; + NSLog(@"Enter a task number to mark it completed"); + int i; + scanf("%d", &i); + //[self markItemDone]; + } + if (i == 6) { + [self printAllCompletedItems:NO]; + } + if (i == 7) { + //print all items in list, versions: either excluding marked done items, or print all incl marked done items with a check sign + [self printAllItemsInList]; + } + if (i == 0) { + NSLog(@"It was good to see you! Bye!"); + } + else { + NSLog(@"Bummer! Try again?"); + } + } +} + + +@end + diff --git a/TodoList/TodoList/ListManager.h b/TodoList/TodoList/ListManager.h new file mode 100644 index 0000000..a79a4ca --- /dev/null +++ b/TodoList/TodoList/ListManager.h @@ -0,0 +1,25 @@ +// +// ListManager.h +// toDoListFromScratchZoufAndAyuna +// +// Created by Ayuna Vogel on 6/30/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. +// + +#import +#import "Item.h" +#import "List.h" +#import "ListManager.h" + +@class ListManager; +@class List; +@class Item; + +@interface ListManager : NSObject +-(NSMutableArray*) getLists; +-(void) addListToListManager: (List*) list; +-(void) renameList; +-(void) deleteListFromListManager: (int) j; +-(void) printLists; +-(void) listManagerMenuOptions; +@end \ No newline at end of file diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m new file mode 100644 index 0000000..4927494 --- /dev/null +++ b/TodoList/TodoList/ListManager.m @@ -0,0 +1,120 @@ +// +// ListManager.m +// toDoListFromScratchZoufAndAyuna +// +// Created by Ayuna Vogel on 6/30/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. +// + +#import "ListManager.h" + +@class Item; +@class List; + +@implementation ListManager { + NSMutableArray *_lists; +} +- (NSMutableArray *) getLists { + if (_lists == nil) { + _lists = [[NSMutableArray alloc] init]; + } + return _lists; +} + +-(void) addListToListManager: (List*) list { + //NSLog(@"Enter a name for your new to-do list"); //commenting it out for now, but it will be in the loop method later + [_lists addObject:list]; + + + //scanf for user input string name for the new to-do list + //[list setListName: user input string for the new to do list name]; + //should list options for that list - home menu list options (display all tasks, add task, etc. +} + +-(void) renameList { + [self printLists]; + NSLog(@"Enter a number to pick a list"); + int j; + scanf("%d", &j); + NSString *oldListName = [[_lists objectAtIndex:j-1] listName]; + NSLog(@"Enter list description"); + char newUserListName[256]; + fgets(newUserListName, 256, stdin); + NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; + oldListName = editedListName; + [_lists replaceObjectAtIndex:j-1 withObject:editedListName]; +} + +-(void) deleteListFromListManager: (int) j { + [_lists removeObjectAtIndex:j-1]; +} +-(void)printLists { + for (int i = 0; i < [_lists count]; i++) { + NSString *listName = [[_lists objectAtIndex:i] listName]; + NSLog(@"%i %@", i+1, listName); + } + //NSLog(@"Enter a number to pick your to-do list"); +} + +-(void) listManagerMenuOptions { + int userInputInteger; + BOOL runListManagerMenuOptions = true; + while (runListManagerMenuOptions) { + + NSArray *listManagerMenuOptions = [[NSArray alloc] initWithObjects:@"1 - Display all to-do lists", @"2 - Add new to-do list", @"3 - Rename a to-do list", @"4 - Delete a to-do list", @"0 - Quit", @"Enter a number to pick your option:", nil]; + NSLog(@"%@", listManagerMenuOptions); + scanf("%d", &userInputInteger); + fpurge(stdin); + + if (userInputInteger == 1) { + [self printLists]; + break; + } + else if (userInputInteger == 2) { +// this next lines of code might not be necessary +// if ([_lists count] == 0) { +// ListManager *newList = [[ListManager alloc]init]; +// } + List *newToDoList = [[List alloc]init]; + [newToDoList addListDescription]; + [newToDoList itemsInList]; + [newToDoList listName]; + [self addListToListManager:newToDoList]; + } + else if (userInputInteger == 3) { + [self printLists]; + NSLog(@"Enter a number to pick a list"); + int j; + scanf("%d", &j); + fpurge(stdin); + NSLog(@"Enter new list description"); + char newUserListName[256]; + fgets(newUserListName, 256, stdin); + NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; + [[_lists objectAtIndex:j-1] setListName:editedListName]; + } + else if (userInputInteger == 4) { + [self printLists]; + int j; + scanf("%d", &j); + [self deleteListFromListManager:j]; + NSLog(@"Deleted"); + } + else if (userInputInteger == 0) { + NSLog(@"It was good to see you! Bye!"); + //runListManagerMenuOptions = false; + break; + } + else { + NSLog(@"Bummer! Try again?"); + } + } +} + +//-(void)sortList { +// _lists = [_lists sortUsingComparator:^NSComparisonResult(NSString *str1, NSString *str2) { +// +// }]; +//} +@end + diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index f5ec7a6..1042105 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -1,242 +1,97 @@ // // main.m -// TodoList +// toDoListFromScratchZoufAndAyuna // -// Created by Zoufishan Mehdi and Ayuna Vogel πŸ‡·πŸ‡ΊπŸ‡ΊπŸ‡Έ {{ in πŸ’› with πŸš• city }} on 6/25/15. -// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// Created by Ayuna Vogel on 6/28/15. +// Copyright (c) 2015 Ayuna Vogel. All rights reserved. // -//checking push for github - Ayuna - - #import +#import "Item.h" +#import "List.h" +#import "ListManager.h" + +@class ListManager; +@class List; +@class Item; + +//************************************** INTERFACE ITEM ******** +//************************************** IMPLEM ITEM ******** +//************************************** INTERFACE LIST ******** +//************************************** IMPLEM LIST ******** +//************************ INTERFACE LIST MANAGER ******** +//************************************** IMPLEM LIST MANAGER ******** +// ************ *********** ****** >>> MAIN FUNCTION <<< ********* ******** ********** -@class ToDoApp; -@class ToDoList; -@class ToDoItem; - -//********************** INTERFACE TO DO APP ********* -@interface ToDoApp : NSObject - --(void)displayLists:(NSMutableArray*)displayLists; --(NSArray *)displayLists; - --(void)addList:(NSMutableArray*)addList; --(NSArray *)addList; - --(void)removeList:(NSMutableArray*)removeList; --(NSArray *)removeList; - --(void)renameList:(NSMutableArray*)renameList; --(NSArray *)renameList; - - -@end - -//*********************** INTERFACE TODO LIST ****** -@interface ToDoList : NSObject - --(void)displayItems:(NSMutableArray*)displayItems; - --(NSString*)addItem:(NSString*)newItemName; - -//-(void)removeItem:(NSString*)remove; -//-(NSString *)remove; -// -//-(void)markItem:(NSString*)mark; -//-(NSString *)mark; -// -//-(void)listCompletedItems:(NSMutableArray*)listCompletedItems; -// -//@end - -//************************INTERFACE TODO ITEM -@interface ToDoItem : NSObject - --(void)setItemName:(NSString *)itemName; --(NSString *)itemName; - --(void)setPriority:(int)priority; --(int *)priority; - -@end - - -//*************** IMPLEM TO DO APP *************** -//@implementation ToDoApp { -// NSMutableArray *_allLists; -//} -// -//-(void)displayLists:(NSMutableArray*)displayLists { -// for(ToDoApp *something in _allLists) { -// printf("%s\n", [[something description] UTF8String]); -// } -} -//-(NSMutableArray *)displayLists { -// return _displayLists; -//} - -//-(void)addList:(NSMutableArray*)addList { -// -//} -//-(NSMutableArray *)addList { -// -//} -// -//-(void)removeList:(NSMutableArray*)removeList { -// -//} -//-(NSMutableArray *)removeList { -// -//} -// -//-(void)renameList:(NSMutableArray*)renameList { -// -//} -// -//-(NSMutableArray *)renameList { -// -//} - - -@end - - - -//*************** IMPLEM TO DO LIST *************** -@implementation ToDoList { - NSString *_listName; - NSMutableArray *_listOfItems; -} --(void)displayItems:(NSMutableArray*)displayItems { - for(ToDoList *listOfItems in _listOfItems) { - printf("%s\n", [[listOfItems description] UTF8String]); - } -} --(void)listCompletedItems:(NSMutableArray*)listCompletedItems { - for(ToDoList *listOfCompletedItems in _listOfItems) { - printf("%s\n", [[listCompletedItems description] UTF8String]); - } -} --(NSString*)addItem:(NSString*)newItemName { - scanf("%s", &newItemName); - -// -// ToDoItem *newItem = [[ToDoItem alloc]init]; -// [newItem setItemName:newItemName]; -// [_listOfItems addObject:newItemName]; -// return newItemName; -} - --(void)renameList:(NSString*) name{ - _listName = name; -} - - --(void)removeItem:(NSString*)remove; -//-(NSString *)remove; - -//-(void)markItem:(NSString*)mark { -////-(NSString *)mark; -//} - - -@end - - - -//*************** IMPLEM TO DO ITEM *************** -@implementation ToDoItem { - NSString *_itemName; - NSInteger *_priority; -} - --(void)setItemName:(NSString *)itemName { - _itemName = itemName; - NSLog(@"%@", itemName); -} --(NSString *)itemName { - return _itemName; -} - --(void)setPriority:(int) priority { - _priority = priority; -} --(int *)priority { - return _priority; -} - -@end - - -//***************** MAIN FUNCTION *********************** int main(int argc, const char * argv[]) { @autoreleasepool { - ToDoItem *homework = [[ToDoItem alloc] init]; - ToDoList *list1 = [[ToDoList alloc] init]; - - [homework setItemName:@"Study Git branching"]; - - int createListYesNo; - printf("Would you like to create a to-do list? \n 0)No 1)Yes \n"); - scanf("%d", &createListYesNo); - - if (createListYesNo == 0) { - return 0; - } else { - NSString *listName; - printf("Enter a name for your to-do list \n"); - scanf("%s", &listName); - [list1 renameList:listName]; - - } - - - - - -// -// int enterOrRun; -// printf("Will I beat superman?, \n 0) I'm ready to defeat superman \n 1) I would rather for my life while I can \n"); -// scanf("%d", &enterOrRun); -// -// //Enter the fork in the road: Batman & Kryptonite -// -// if (enterOrRun == 0) { -// int batmanVsKryptonite; -// printf("Which path do you choose: Goddamned Batman or Kryptonite? \n 0)Batman, here we go! \n 1) Batwhat? I will go with Kryptonite \n"); -// scanf("%d", &batmanVsKryptonite); -// //You choose Batman -// if (batmanVsKryptonite == 0) { -// int batOrNot; -// printf("Am I the Goddamned Batman? \n 0)Why yes! I also have batwings \n 1) Definitely not! Can I pretend though? \n"); -// scanf("%d", &batOrNot); -// //You are batman -// if ((batOrNot == 0) && batwings){ -// printf("Maybe, once. On a good day."); -// //You are not batman -// } else { -// printf("No. You lose HORRIBLY!"); -// } -// - - //Arrays -// NSMutableArray *myArray = [[NSMutableArray alloc] init]; -// NSArray *array = [[[NSArray alloc]] initWithObjects:@"one", -// @"two", nil]; - - // Person *person = [[Person alloc] init]; -// [myArray addObject:[person name]]; -// [[myArray firstObject] danceInTheRain]; -// -// -// [myArray addObject:@"mike"]; -// NSString *name = @"mike"; -// [name length]; -// -// NSString *myName = [myArray firstObject]; -// [myName length]; + Item *firstTask = [[Item alloc]init]; + [firstTask setItem:@"Buy bananas"]; + [firstTask setItemPriority:1]; + + Item *secondTask = [[Item alloc]init]; + [secondTask setItem:@"Buy coffee and tea"]; + [secondTask setItemPriority:2]; + + List *groceryList = [[List alloc]init]; + [groceryList setListName:@"Grocery List"]; + [groceryList itemsInList]; + [groceryList addItemToList:firstTask]; + [groceryList addItemToList:secondTask]; + //[groceryList printAllItemsInList]; + //[groceryList editItemName:secondTask]; + + + Item *finishToDoListAppProject = [[Item alloc] init]; + [finishToDoListAppProject setItem:@"Finish to-do list app project"]; + [finishToDoListAppProject setItemPriority:1]; + + Item *learnGitBranching = [[Item alloc] init]; + [learnGitBranching setItem:@"Learn Git branching"]; + [learnGitBranching setItemPriority:2]; + Item *readBook = [[Item alloc] init]; + [readBook setItem:@"Read Objective-C programming: The big nerd ranch guide book"]; + [readBook setItemPriority:3]; + + List *homeworkToDoList = [[List alloc] init]; + [homeworkToDoList itemsInList]; + [homeworkToDoList setListName:@"Homework"]; + [homeworkToDoList addItemToList:finishToDoListAppProject]; + [homeworkToDoList addItemToList:learnGitBranching]; + [homeworkToDoList addItemToList:readBook]; + //[homeworkToDoList printAllItemsInList]; + + ListManager *allLists = [[ListManager alloc]init]; + [allLists getLists]; + [allLists addListToListManager: groceryList]; + [allLists addListToListManager:homeworkToDoList]; + + NSLog(@"Welcome to your to-do list app! Let's get you started:\n"); + [allLists listManagerMenuOptions]; //prints List Manager options menu + + + + + //[groceryList deleteItemFromList:firstTask]; + //[groceryList printAllItemsInList]; + //[groceryList markItemDone:secondTask]; +// [groceryList printAllItemsInList]; + + + + + //[groceryList listOptions]; + + + + + + + + + + } return 0; } diff --git a/unit-0-assessment b/unit-0-assessment deleted file mode 160000 index 70549bd..0000000 --- a/unit-0-assessment +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 70549bd8f68215e89b1c886a1723c3addc43f99f From 58bc9d581e9d38aafb96407b95c56b6f9a3229c9 Mon Sep 17 00:00:00 2001 From: ayunav Date: Wed, 1 Jul 2015 23:45:20 -0400 Subject: [PATCH 11/19] runs display lists, pick a list, and display tasks inside the list properly. YAYgit add . --- TodoList/TodoList/List.m | 18 +++++++++--------- TodoList/TodoList/ListManager.m | 9 ++++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 00df98d..76a2c70 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -44,7 +44,7 @@ -(void) printAllItemsInList { for (int i = 0; i < [_itemsInList count]; i++) { NSString *itemName = [[_itemsInList objectAtIndex:i] itemName]; int itemPriority = [[_itemsInList objectAtIndex:i] itemPriority]; - NSLog(@"%i %@, %d", i+1, itemName, itemPriority); + NSLog(@"%i %@, priority %d", i+1, itemName, itemPriority); } } @@ -53,7 +53,7 @@ -(void) printAllCompletedItems:(BOOL) value { if ([[_itemsInList objectAtIndex:i] markedDone] == value) { NSString *itemName = [[_itemsInList objectAtIndex:i] itemName]; int itemPriority = [[_itemsInList objectAtIndex:i] itemPriority]; - NSLog(@"%i %@, %d", i+1, itemName, itemPriority); + NSLog(@"%i %@, priority %d", i+1, itemName, itemPriority); } } } @@ -123,7 +123,7 @@ -(void) listOptions { //print all items in list [self printAllItemsInList]; } - if (i == 2) { + else if (i == 2) { //add new item [self printAllItemsInList]; NSLog(@"Enter a list number to add an item to"); @@ -131,7 +131,7 @@ -(void) listOptions { scanf("%d", &i); // [self addItemToList:<#(Item *)#>:i]; } - if (i == 3) { + else if (i == 3) { //rename item [self printAllItemsInList]; NSLog(@"Enter an item number to rename it"); @@ -139,7 +139,7 @@ -(void) listOptions { scanf("%d", &i); [self editItemName]; } - if (i == 4) { + else if (i == 4) { //delete item [self printAllItemsInList]; NSLog(@"Enter an item number to delete it"); @@ -147,7 +147,7 @@ -(void) listOptions { scanf("%d", &i); [self deleteItemFromList]; } - if (i == 5) { + else if (i == 5) { //mark task done [self printAllItemsInList]; NSLog(@"Enter a task number to mark it completed"); @@ -155,14 +155,14 @@ -(void) listOptions { scanf("%d", &i); //[self markItemDone]; } - if (i == 6) { + else if (i == 6) { [self printAllCompletedItems:NO]; } - if (i == 7) { + else if (i == 7) { //print all items in list, versions: either excluding marked done items, or print all incl marked done items with a check sign [self printAllItemsInList]; } - if (i == 0) { + else if (i == 0) { NSLog(@"It was good to see you! Bye!"); } else { diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index 4927494..30fa50a 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -53,7 +53,14 @@ -(void)printLists { NSString *listName = [[_lists objectAtIndex:i] listName]; NSLog(@"%i %@", i+1, listName); } - //NSLog(@"Enter a number to pick your to-do list"); + NSLog(@"Enter a number to pick your to-do list"); + int j; + scanf("%d", &j); + for (int i = 0; i < [_lists count]; i++) { + if (i == j -1 ) { + [[_lists objectAtIndex:i] listOptions]; + } + } } -(void) listManagerMenuOptions { From 1eb4e8d89fdda7da1314c02ef7b2da79c0b9c53a Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 00:01:59 -0400 Subject: [PATCH 12/19] delete task method runs properly --- TodoList/TodoList/List.m | 20 ++++++-------------- TodoList/TodoList/ListManager.m | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 76a2c70..9448c72 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -33,11 +33,7 @@ -(void) deleteItemFromList { NSLog(@"Enter a number to delete task"); int j; scanf("%d", &j); - for (int i = 0; i < [_itemsInList count]; i++) { - if (i == j) { - [_itemsInList removeObjectAtIndex:j-1]; - } - } + [_itemsInList removeObjectAtIndex:j-1]; } -(void) printAllItemsInList { @@ -120,16 +116,11 @@ -(void) listOptions { fpurge(stdin); if (i == 1) { - //print all items in list [self printAllItemsInList]; } else if (i == 2) { //add new item - [self printAllItemsInList]; - NSLog(@"Enter a list number to add an item to"); - int i; - scanf("%d", &i); - // [self addItemToList:<#(Item *)#>:i]; + //[self addItemToList:<#(Item *)#>:i]; } else if (i == 3) { //rename item @@ -142,10 +133,11 @@ -(void) listOptions { else if (i == 4) { //delete item [self printAllItemsInList]; - NSLog(@"Enter an item number to delete it"); - int i; - scanf("%d", &i); +// NSLog(@"Enter an item number to delete it"); +// int i; +// scanf("%d", &i); [self deleteItemFromList]; + NSLog(@"Deleted"); } else if (i == 5) { //mark task done diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index 30fa50a..7c7bce4 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -51,7 +51,7 @@ -(void) deleteListFromListManager: (int) j { -(void)printLists { for (int i = 0; i < [_lists count]; i++) { NSString *listName = [[_lists objectAtIndex:i] listName]; - NSLog(@"%i %@", i+1, listName); + NSLog(@"%i) %@", i+1, listName); } NSLog(@"Enter a number to pick your to-do list"); int j; From ae9de81bd488f9db467b9b079a96ef00b707f3ff Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 00:29:32 -0400 Subject: [PATCH 13/19] last commit for Wednesday night --- TodoList/TodoList/List.m | 15 ++++++++++++--- TodoList/TodoList/ListManager.m | 10 ---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 9448c72..3fc0858 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -109,23 +109,28 @@ -(void) listOptions { BOOL runListOptionsMenu = true; while (runListOptionsMenu) { - NSArray *listOptions = [[NSArray alloc] initWithObjects:@"1 - Display all tasks", @"2 - Add new task", @"3 - Edit task", @"4 - Delete task", @"5 - Mark task done", @"6 - List all active tasks", @"7 - List completed tasks", @"0 - Quit", nil]; + NSArray *listOptions = [[NSArray alloc] initWithObjects:@"1 - Display all tasks", @"2 - Add new task", @"3 - Edit task", @"4 - Delete task", @"5 - Mark task done", @"6 - List all active tasks", @"7 - List completed tasks", @"8 - Go back to Lists", @"0 - Quit", nil]; NSLog(@"%@", listOptions); scanf("%d", &i); fpurge(stdin); if (i == 1) { + //display all items in the selected list [self printAllItemsInList]; } else if (i == 2) { //add new item - //[self addItemToList:<#(Item *)#>:i]; + NSLog(@"Enter task description: "); + Item *newToDoItem = [[Item alloc]init]; + [newToDoItem addItemDescription]; + [newToDoItem itemName]; + [self addItemToList:newToDoItem]; } else if (i == 3) { //rename item [self printAllItemsInList]; - NSLog(@"Enter an item number to rename it"); + NSLog(@"Enter a number to edit task"); int i; scanf("%d", &i); [self editItemName]; @@ -153,9 +158,13 @@ -(void) listOptions { else if (i == 7) { //print all items in list, versions: either excluding marked done items, or print all incl marked done items with a check sign [self printAllItemsInList]; + } + else if (i == 8) { + } else if (i == 0) { NSLog(@"It was good to see you! Bye!"); + break; } else { NSLog(@"Bummer! Try again?"); diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index 7c7bce4..78e8f1f 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -22,13 +22,7 @@ - (NSMutableArray *) getLists { } -(void) addListToListManager: (List*) list { - //NSLog(@"Enter a name for your new to-do list"); //commenting it out for now, but it will be in the loop method later [_lists addObject:list]; - - - //scanf for user input string name for the new to-do list - //[list setListName: user input string for the new to do list name]; - //should list options for that list - home menu list options (display all tasks, add task, etc. } -(void) renameList { @@ -78,10 +72,6 @@ -(void) listManagerMenuOptions { break; } else if (userInputInteger == 2) { -// this next lines of code might not be necessary -// if ([_lists count] == 0) { -// ListManager *newList = [[ListManager alloc]init]; -// } List *newToDoList = [[List alloc]init]; [newToDoList addListDescription]; [newToDoList itemsInList]; From 2d3b0a8231b9aad47272325e5500a59f47db136f Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 00:58:06 -0400 Subject: [PATCH 14/19] commit to update new branch ayuna-thu on github online --- TodoList/TodoList/main.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 1042105..32df668 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -90,7 +90,8 @@ int main(int argc, const char * argv[]) { - + + // added comment to update my new branch on github } return 0; From e614868177c9f017c5eb75a5908ea0e182107aa8 Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 13:38:10 -0400 Subject: [PATCH 15/19] delete list method runs properly, commented out some lines in printLists method --- TodoList/TodoList/List.m | 5 ++- TodoList/TodoList/ListManager.h | 2 +- TodoList/TodoList/ListManager.m | 64 +++++++++++++++------------------ 3 files changed, 32 insertions(+), 39 deletions(-) diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 3fc0858..462b5c6 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -95,10 +95,9 @@ -(void) editItemName { -(void) addListDescription { NSLog(@"Enter list description: "); - // fgets method allows user to input more than one word ie: "finish project" char listDescriptionInput[256]; fgets(listDescriptionInput, 256, stdin); - // NSLog(@"item added: %s", name); // we test our work above here + // NSLog(@"item added: %s", name); // we test our work above here NSString *listDescription = [NSString stringWithUTF8String:listDescriptionInput]; //stringWithUTF8String converts char to string // NSLog(@"string test: %@", item1); [self setListName:listDescription]; @@ -109,7 +108,7 @@ -(void) listOptions { BOOL runListOptionsMenu = true; while (runListOptionsMenu) { - NSArray *listOptions = [[NSArray alloc] initWithObjects:@"1 - Display all tasks", @"2 - Add new task", @"3 - Edit task", @"4 - Delete task", @"5 - Mark task done", @"6 - List all active tasks", @"7 - List completed tasks", @"8 - Go back to Lists", @"0 - Quit", nil]; + NSArray *listOptions = [[NSArray alloc] initWithObjects:@"1 - Display all tasks", @"2 - Add new task", @"3 - Edit task", @"4 - Delete task", @"5 - Mark task done", @"6 - List all active tasks", @"7 - List completed tasks", @"8 - Go back to Lists Menu", @"0 - Quit", nil]; NSLog(@"%@", listOptions); scanf("%d", &i); diff --git a/TodoList/TodoList/ListManager.h b/TodoList/TodoList/ListManager.h index a79a4ca..cd52268 100644 --- a/TodoList/TodoList/ListManager.h +++ b/TodoList/TodoList/ListManager.h @@ -19,7 +19,7 @@ -(NSMutableArray*) getLists; -(void) addListToListManager: (List*) list; -(void) renameList; --(void) deleteListFromListManager: (int) j; +-(void) deleteListFromListManager; -(void) printLists; -(void) listManagerMenuOptions; @end \ No newline at end of file diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index 78e8f1f..b924661 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -26,35 +26,41 @@ -(void) addListToListManager: (List*) list { } -(void) renameList { - [self printLists]; - NSLog(@"Enter a number to pick a list"); +// [self printLists]; +// NSLog(@"Enter a number to pick a list"); int j; scanf("%d", &j); - NSString *oldListName = [[_lists objectAtIndex:j-1] listName]; - NSLog(@"Enter list description"); - char newUserListName[256]; - fgets(newUserListName, 256, stdin); - NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; - oldListName = editedListName; - [_lists replaceObjectAtIndex:j-1 withObject:editedListName]; + fpurge(stdin); + for (int i = 0; i < [_lists count]; i++) { + if (i == j-1) { + NSLog(@"Enter new list description"); + char newUserListName[256]; + fgets(newUserListName, 256, stdin); + NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; + [[_lists objectAtIndex:j-1] setListName:editedListName]; + } + } } --(void) deleteListFromListManager: (int) j { - [_lists removeObjectAtIndex:j-1]; +-(void) deleteListFromListManager { + int j; + scanf("%d", &j); + [_lists removeObjectAtIndex:j-1]; } + -(void)printLists { for (int i = 0; i < [_lists count]; i++) { NSString *listName = [[_lists objectAtIndex:i] listName]; NSLog(@"%i) %@", i+1, listName); } - NSLog(@"Enter a number to pick your to-do list"); - int j; - scanf("%d", &j); - for (int i = 0; i < [_lists count]; i++) { - if (i == j -1 ) { - [[_lists objectAtIndex:i] listOptions]; - } - } + NSLog(@"Enter a number to pick a list"); +// int j; +// scanf("%d", &j); +// for (int i = 0; i < [_lists count]; i++) { +// if (i == j -1 ) { +// [[_lists objectAtIndex:i] listOptions]; +// } +// } } -(void) listManagerMenuOptions { @@ -81,20 +87,13 @@ -(void) listManagerMenuOptions { else if (userInputInteger == 3) { [self printLists]; NSLog(@"Enter a number to pick a list"); - int j; - scanf("%d", &j); - fpurge(stdin); - NSLog(@"Enter new list description"); - char newUserListName[256]; - fgets(newUserListName, 256, stdin); - NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; - [[_lists objectAtIndex:j-1] setListName:editedListName]; + [self renameList]; + break; } else if (userInputInteger == 4) { + // delete a to-do list [self printLists]; - int j; - scanf("%d", &j); - [self deleteListFromListManager:j]; + [self deleteListFromListManager]; NSLog(@"Deleted"); } else if (userInputInteger == 0) { @@ -108,10 +107,5 @@ -(void) listManagerMenuOptions { } } -//-(void)sortList { -// _lists = [_lists sortUsingComparator:^NSComparisonResult(NSString *str1, NSString *str2) { -// -// }]; -//} @end From a896d7f940076620c1a222b91a14d9153d998c77 Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 13:45:34 -0400 Subject: [PATCH 16/19] display lists -> display tasks so far run --- TodoList/TodoList/ListManager.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index b924661..1d13932 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -75,6 +75,14 @@ -(void) listManagerMenuOptions { if (userInputInteger == 1) { [self printLists]; + int j; + scanf("%d", &j); + for (int i = 0; i < [_lists count]; i++) { + if (i == j -1 ) { + [[_lists objectAtIndex:i] listOptions]; + } + } + break; } else if (userInputInteger == 2) { From d549a41e137c9b56fab953bef60d95db02068235 Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 14:26:19 -0400 Subject: [PATCH 17/19] rename list method runs properly, fixed it --- TodoList/TodoList/List.m | 2 +- TodoList/TodoList/ListManager.m | 21 +++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 462b5c6..939a7fd 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -40,7 +40,7 @@ -(void) printAllItemsInList { for (int i = 0; i < [_itemsInList count]; i++) { NSString *itemName = [[_itemsInList objectAtIndex:i] itemName]; int itemPriority = [[_itemsInList objectAtIndex:i] itemPriority]; - NSLog(@"%i %@, priority %d", i+1, itemName, itemPriority); + NSLog(@"%i) %@, priority %d", i+1, itemName, itemPriority); } } diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index 1d13932..d4027ae 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -26,20 +26,15 @@ -(void) addListToListManager: (List*) list { } -(void) renameList { -// [self printLists]; -// NSLog(@"Enter a number to pick a list"); + [self printLists]; int j; scanf("%d", &j); fpurge(stdin); - for (int i = 0; i < [_lists count]; i++) { - if (i == j-1) { - NSLog(@"Enter new list description"); - char newUserListName[256]; - fgets(newUserListName, 256, stdin); - NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; - [[_lists objectAtIndex:j-1] setListName:editedListName]; - } - } + NSLog(@"Enter new list description"); + char newUserListName[256]; + fgets(newUserListName, 256, stdin); + NSString *editedListName = [NSString stringWithUTF8String:newUserListName]; + [[_lists objectAtIndex:j-1] setListName:editedListName]; } -(void) deleteListFromListManager { @@ -93,10 +88,8 @@ -(void) listManagerMenuOptions { [self addListToListManager:newToDoList]; } else if (userInputInteger == 3) { - [self printLists]; - NSLog(@"Enter a number to pick a list"); + //rename a list [self renameList]; - break; } else if (userInputInteger == 4) { // delete a to-do list From 46510f6be6e5398bc75dd0357eaf00352d2a8c50 Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 14:50:03 -0400 Subject: [PATCH 18/19] fixed edit task (renameItem) method, runs properly --- TodoList/TodoList/List.h | 2 +- TodoList/TodoList/List.m | 41 ++++++++++++---------------------------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/TodoList/TodoList/List.h b/TodoList/TodoList/List.h index 110f92c..a46e9c0 100644 --- a/TodoList/TodoList/List.h +++ b/TodoList/TodoList/List.h @@ -23,7 +23,7 @@ -(void) deleteItemFromList; -(void) printAllItemsInList; -(void) markItemDone: (Item *) task; -//-(void) editItemName; +-(void) renameItem; -(void) listOptions; -(void) addListDescription; @end \ No newline at end of file diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 939a7fd..931ec67 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -68,29 +68,17 @@ -(void) markItemDone: (Item *) task { } } --(void) editItemName { - //print the list of items in this list - NSLog(@"Enter a number to pick a task to edit"); -// first version of this code - doesn't work -// NSLog(@"Enter task description"); -// char newItemName[256]; -// fgets(newItemName, 256, stdin); -// NSString *editedItemName = [NSString stringWithUTF8String:newItemName]; - -//2nd version: - //if scanf user input = edit task { -// int j; -// scanf("%d", &j); -// for (int i = 0; i < [_itemsInList count]; i++) { -// if (j == i) { -// NSString *itemName = [[_itemsInList objectAtIndex:j-1] itemName]; -// NSLog(@"Enter task description"); -// char newItemName[256]; -// fgets(newItemName, 256, stdin); -// NSString *editedItemName = [NSString stringWithUTF8String:newItemName]; -// itemName = editedItemName; -// } -// } +-(void) renameItem { + [self printAllItemsInList]; + NSLog(@"Enter a number to edit task"); + int j; + scanf("%d", &j); + fpurge(stdin); + NSLog(@"Enter new task description"); + char newTaskName[256]; + fgets(newTaskName, 256, stdin); + NSString *editedTaskName = [NSString stringWithUTF8String:newTaskName]; + [[_itemsInList objectAtIndex:j-1] setItem:editedTaskName]; } -(void) addListDescription { @@ -120,7 +108,6 @@ -(void) listOptions { } else if (i == 2) { //add new item - NSLog(@"Enter task description: "); Item *newToDoItem = [[Item alloc]init]; [newToDoItem addItemDescription]; [newToDoItem itemName]; @@ -128,11 +115,7 @@ -(void) listOptions { } else if (i == 3) { //rename item - [self printAllItemsInList]; - NSLog(@"Enter a number to edit task"); - int i; - scanf("%d", &i); - [self editItemName]; + [self renameItem]; } else if (i == 4) { //delete item From 3e4ffbdfd9b927fd7754ac475251ed2fdccf678b Mon Sep 17 00:00:00 2001 From: ayunav Date: Thu, 2 Jul 2015 15:15:28 -0400 Subject: [PATCH 19/19] just cleaned up the code in all files, added go back to lists method but it doesn't work --- TodoList/TodoList/Item.m | 7 +++---- TodoList/TodoList/List.h | 1 + TodoList/TodoList/List.m | 26 +++++++++++++++++++------- TodoList/TodoList/ListManager.m | 8 -------- TodoList/TodoList/main.m | 28 ++++------------------------ 5 files changed, 27 insertions(+), 43 deletions(-) diff --git a/TodoList/TodoList/Item.m b/TodoList/TodoList/Item.m index d5d8eac..5508dfa 100644 --- a/TodoList/TodoList/Item.m +++ b/TodoList/TodoList/Item.m @@ -21,12 +21,11 @@ -(void) setItem: (NSString *) item { -(void) addItemDescription { NSLog(@"Enter task description: "); - // fgets method allows user to input more than one word ie: "finish project" + //fgets method allows user to input more than one word ie: "finish project" char itemInput[256]; fgets(itemInput, 256, stdin); - // NSLog(@"item added: %s", name); // we test our work above here - NSString *itemDescription = [NSString stringWithUTF8String:itemInput]; //stringWithUTF8String converts char to string - // NSLog(@"string test: %@", item1); + NSString *itemDescription = [NSString stringWithUTF8String:itemInput]; + //stringWithUTF8String converts char to string [self setItem: itemDescription]; } diff --git a/TodoList/TodoList/List.h b/TodoList/TodoList/List.h index a46e9c0..6e574ae 100644 --- a/TodoList/TodoList/List.h +++ b/TodoList/TodoList/List.h @@ -25,5 +25,6 @@ -(void) markItemDone: (Item *) task; -(void) renameItem; -(void) listOptions; +-(void) goBackToLists; -(void) addListDescription; @end \ No newline at end of file diff --git a/TodoList/TodoList/List.m b/TodoList/TodoList/List.m index 931ec67..bc50115 100644 --- a/TodoList/TodoList/List.m +++ b/TodoList/TodoList/List.m @@ -7,6 +7,8 @@ // #import "List.h" +@class ListManager; +@class List; @implementation List { NSString* _listName; @@ -81,13 +83,26 @@ -(void) renameItem { [[_itemsInList objectAtIndex:j-1] setItem:editedTaskName]; } +-(void) goBackToLists { + //if (_lists == nil) { + //allocate new object of ListManager + // } + //[[_lists objectAtIndex: i] listManagerMenuOptions]; + // int j; +// scanf("%d", &j); +// for (int i = 0; i < [_lists count]; i++) { +// if (j == 8) { +// [[_lists objectAtIndex:i] listManagerMenuOptions]; +// } +// } +} + -(void) addListDescription { NSLog(@"Enter list description: "); char listDescriptionInput[256]; fgets(listDescriptionInput, 256, stdin); - // NSLog(@"item added: %s", name); // we test our work above here - NSString *listDescription = [NSString stringWithUTF8String:listDescriptionInput]; //stringWithUTF8String converts char to string - // NSLog(@"string test: %@", item1); + NSString *listDescription = [NSString stringWithUTF8String:listDescriptionInput]; + //stringWithUTF8String converts char to string [self setListName:listDescription]; } @@ -120,9 +135,6 @@ -(void) listOptions { else if (i == 4) { //delete item [self printAllItemsInList]; -// NSLog(@"Enter an item number to delete it"); -// int i; -// scanf("%d", &i); [self deleteItemFromList]; NSLog(@"Deleted"); } @@ -142,7 +154,7 @@ -(void) listOptions { [self printAllItemsInList]; } else if (i == 8) { - + [self goBackToLists]; } else if (i == 0) { NSLog(@"It was good to see you! Bye!"); diff --git a/TodoList/TodoList/ListManager.m b/TodoList/TodoList/ListManager.m index d4027ae..7b831eb 100644 --- a/TodoList/TodoList/ListManager.m +++ b/TodoList/TodoList/ListManager.m @@ -49,13 +49,6 @@ -(void)printLists { NSLog(@"%i) %@", i+1, listName); } NSLog(@"Enter a number to pick a list"); -// int j; -// scanf("%d", &j); -// for (int i = 0; i < [_lists count]; i++) { -// if (i == j -1 ) { -// [[_lists objectAtIndex:i] listOptions]; -// } -// } } -(void) listManagerMenuOptions { @@ -99,7 +92,6 @@ -(void) listManagerMenuOptions { } else if (userInputInteger == 0) { NSLog(@"It was good to see you! Bye!"); - //runListManagerMenuOptions = false; break; } else { diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 32df668..6e57025 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -15,12 +15,6 @@ @class List; @class Item; -//************************************** INTERFACE ITEM ******** -//************************************** IMPLEM ITEM ******** -//************************************** INTERFACE LIST ******** -//************************************** IMPLEM LIST ******** -//************************ INTERFACE LIST MANAGER ******** -//************************************** IMPLEM LIST MANAGER ******** // ************ *********** ****** >>> MAIN FUNCTION <<< ********* ******** ********** int main(int argc, const char * argv[]) { @@ -67,32 +61,18 @@ int main(int argc, const char * argv[]) { [allLists addListToListManager: groceryList]; [allLists addListToListManager:homeworkToDoList]; - NSLog(@"Welcome to your to-do list app! Let's get you started:\n"); - [allLists listManagerMenuOptions]; //prints List Manager options menu - - - - //[groceryList deleteItemFromList:firstTask]; //[groceryList printAllItemsInList]; //[groceryList markItemDone:secondTask]; -// [groceryList printAllItemsInList]; - - - - + //[groceryList printAllItemsInList]; //[groceryList listOptions]; + NSLog(@"Welcome to your to-do list app! Let's get you started:\n"); + [allLists listManagerMenuOptions]; //prints List Manager options menu + - - - - - - // added comment to update my new branch on github - } return 0; }