From b6b4d322136c765e8c799eeb077edf38f8346dc4 Mon Sep 17 00:00:00 2001 From: Jamaal Date: Sat, 27 Jun 2015 10:12:58 -0400 Subject: [PATCH 01/11] first commit.j --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 082e4ed..c20cb08 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,5 @@ All directions are here... https://github.com/accesscode-2-2/unit-0/tree/master/project Instructions on forking and pull requests here... https://github.com/accesscode-2-2/how-to-pr + +changed ReadMe From 6cc06e05747450c63c6d90cc1e94c39af233de12 Mon Sep 17 00:00:00 2001 From: Jamaal Date: Sat, 27 Jun 2015 12:20:29 -0400 Subject: [PATCH 02/11] second commit.j --- TodoList/TodoList/main.m | 73 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 187be40..725dad5 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -5,13 +5,82 @@ // Created by Michael Kavouras on 6/25/15. // Copyright (c) 2015 Mike Kavouras. All rights reserved. // +//Requirements +// +//1. Does not crash. +//2. Gracefully handle unacceptable user input +//3. Structural requirements +// +// A class to manage your todo lists +// A class to represent a todo list +// A class to represent a todo item +// +//Features +// +//1. Create lists +//2. Add an item to a list +//3. Delete an item from a list +//4. Mark an item as "done" +//5. Edit an item +//6. Set priority on items (1 - 4; default = 1); +//7. List active (not marked done) items in list +//8. List inactive (marked done) items in list + #import +//To Do List Manager + +@interface Manager : NSObject + +- (void) ToDoHome; +- (void) createList; + +@end + +@implementation Manager + + +- (void) ToDoHome { + NSLog(@"What would you like to do?\n1-list items\n2-add item\n3-remove item\n4-mark item done\n5-list completed item"); + +} + + +- (void) createList{ + NSMutableArray *list = [[NSMutableArray alloc] init]; +} + + +@end + +// Represent To Do List + +@interface ToDoList : NSObject + +@end + +@implementation ToDoList + +@end + +// Represent To Do Item + +@interface Item : NSObject + +@end + +@implementation Item + +@end + + int main(int argc, const char * argv[]) { @autoreleasepool { - // insert code here... - NSLog(@"Hello, World!"); + + Manager *ListManager = [[Manager alloc]init]; + [ListManager ToDoHome]; + } return 0; } From 8b79008d9d525ff2c01ff440465770bc45a5ba97 Mon Sep 17 00:00:00 2001 From: Lauren Date: Sat, 27 Jun 2015 12:52:04 -0400 Subject: [PATCH 03/11] working on to do list --- TodoList/TodoList/main.m | 71 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 725dad5..06b8060 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -38,22 +38,74 @@ - (void) createList; @end -@implementation Manager +@implementation Manager { + + NSMutableArray *_yourList; + + +} + - (void) ToDoHome { - NSLog(@"What would you like to do?\n1-list items\n2-add item\n3-remove item\n4-mark item done\n5-list completed item"); + NSLog(@"What would you like to do?\n1- list items\n2- add item\n3- remove item\n4- mark item done\n5- list completed item"); + + + int i; + scanf("%d", &i); + + for (int j = 0; j < 5; j++) { + + if (i == 1) { + NSLog(@"You chose to list items"); + NSLog(@"Your list:"); + _yourList = [[NSMutableArray alloc] init]; + NSLog(@"%@", _yourList); + } + + if (i == 2) { + NSLog(@"You chose to add an item"); + } + + if (i == 3) { + NSLog(@"You chose to remove an item"); + } + + if (i == 4) { + NSLog(@"You chose to mark an item as completed"); + } + + if (i == 5 ) { + NSLog(@"You chose to list completed item"); } + + } } -- (void) createList{ - NSMutableArray *list = [[NSMutableArray alloc] init]; + + +// +//- (void) createList{ // creating list if there is none +// if (_list == nil) { +// _list = [[NSMutableArray alloc] init]; +// } else { +// [_list addObject:listItem]; +// } +//} + + + +- (void) addItem { + } @end + + + // Represent To Do List @interface ToDoList : NSObject @@ -64,6 +116,9 @@ @implementation ToDoList @end + + + // Represent To Do Item @interface Item : NSObject @@ -75,12 +130,18 @@ @implementation Item @end +// ============================================================== + int main(int argc, const char * argv[]) { @autoreleasepool { Manager *ListManager = [[Manager alloc]init]; [ListManager ToDoHome]; - +// [ListManager createList]; + + + + } return 0; } From 42fdc19eba56b656ca25a3297130761ed3f217c8 Mon Sep 17 00:00:00 2001 From: Jamaal Date: Sat, 27 Jun 2015 15:10:00 -0400 Subject: [PATCH 04/11] update.j --- TodoList/TodoList/main.m | 45 +++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 06b8060..fbe4f6e 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -35,36 +35,38 @@ @interface Manager : NSObject - (void) ToDoHome; - (void) createList; +- (void) showList; +- (void) addItem; @end @implementation Manager { NSMutableArray *_yourList; - + NSString *_newItem; } - - (void) ToDoHome { NSLog(@"What would you like to do?\n1- list items\n2- add item\n3- remove item\n4- mark item done\n5- list completed item"); - + int i; scanf("%d", &i); - for (int j = 0; j < 5; j++) { +// for (int j = 0; j < 5; j++) { if (i == 1) { NSLog(@"You chose to list items"); NSLog(@"Your list:"); - _yourList = [[NSMutableArray alloc] init]; - NSLog(@"%@", _yourList); + } if (i == 2) { - NSLog(@"You chose to add an item"); + NSLog(@"You chose to add an item. Please enter a description:"); + [self addItem]; + // scanf(%) } if (i == 3) { @@ -80,9 +82,15 @@ - (void) ToDoHome { } +//} +// +- (void) showList{ + + NSLog(@"%@", _yourList); } - +//const *char cString = "Hello"; +//NSString *myNSString = [NSString stringWithUTF8String:cString]; // @@ -96,9 +104,24 @@ - (void) ToDoHome { -- (void) addItem { +- (void) addItem{ + + char word; + scanf("%s", &word); + NSString *_newItem = [NSString stringWithUTF8String:&word]; + + NSMutableArray *_yourList = [[NSMutableArray alloc] init]; -} + [_yourList addObject:_newItem]; + + for (int i = 0; i < [_yourList count]; i++) { + NSLog(@"Your list so far: \n%@\n", _yourList[i]); + } + + [self ToDoHome]; + + } + @end @@ -110,6 +133,8 @@ - (void) addItem { @interface ToDoList : NSObject + + @end @implementation ToDoList From bc2d9525ef46af9b9e25224de35168a663e8842b Mon Sep 17 00:00:00 2001 From: Lauren Date: Sat, 27 Jun 2015 16:01:38 -0400 Subject: [PATCH 05/11] 401 pm commit --- TodoList/TodoList/main.m | 52 +++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index fbe4f6e..8231238 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -36,14 +36,14 @@ @interface Manager : NSObject - (void) ToDoHome; - (void) createList; - (void) showList; -- (void) addItem; +- (void) addItem:(NSString *)newItem; @end @implementation Manager { NSMutableArray *_yourList; - NSString *_newItem; + //NSString *_newItem; } @@ -59,8 +59,7 @@ - (void) ToDoHome { if (i == 1) { NSLog(@"You chose to list items"); - NSLog(@"Your list:"); - + [self showList]; } if (i == 2) { @@ -84,23 +83,18 @@ - (void) ToDoHome { //} // -- (void) showList{ - - NSLog(@"%@", _yourList); -} + //const *char cString = "Hello"; //NSString *myNSString = [NSString stringWithUTF8String:cString]; -// -//- (void) createList{ // creating list if there is none -// if (_list == nil) { -// _list = [[NSMutableArray alloc] init]; -// } else { -// [_list addObject:listItem]; -// } -//} + +- (void) createList{ // creating list if there is none + + _yourList = [[NSMutableArray alloc] init]; // initializing array + +} @@ -108,15 +102,11 @@ - (void) addItem{ char word; scanf("%s", &word); - NSString *_newItem = [NSString stringWithUTF8String:&word]; + NSString *_newItem = [NSString stringWithUTF8String:&word]; // converting to string - NSMutableArray *_yourList = [[NSMutableArray alloc] init]; - [_yourList addObject:_newItem]; - for (int i = 0; i < [_yourList count]; i++) { - NSLog(@"Your list so far: \n%@\n", _yourList[i]); - } + [_yourList addObject:_newItem]; // add new item to your list [self ToDoHome]; @@ -124,6 +114,16 @@ - (void) addItem{ +- (void) showList{ + + for (int i = 0; i < [_yourList count]; i++) + { + NSLog(@"%@", _yourList[i]); + } + + [self ToDoHome]; +} + @end @@ -134,7 +134,6 @@ - (void) addItem{ @interface ToDoList : NSObject - @end @implementation ToDoList @@ -161,8 +160,13 @@ int main(int argc, const char * argv[]) { @autoreleasepool { Manager *ListManager = [[Manager alloc]init]; + + [ListManager createList]; + [ListManager ToDoHome]; -// [ListManager createList]; + + + From 4ddb522ada174fb378d3f4045946ed6466f85c02 Mon Sep 17 00:00:00 2001 From: Jamaal Date: Sat, 27 Jun 2015 16:48:20 -0400 Subject: [PATCH 06/11] 4:50 commit --- TodoList/TodoList/main.m | 73 +++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 20 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 8231238..385339e 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -17,9 +17,9 @@ // //Features // -//1. Create lists -//2. Add an item to a list -//3. Delete an item from a list +//1. Create lists * +//2. Add an item to a list * +//3. Delete an item from a list * //4. Mark an item as "done" //5. Edit an item //6. Set priority on items (1 - 4; default = 1); @@ -36,7 +36,9 @@ @interface Manager : NSObject - (void) ToDoHome; - (void) createList; - (void) showList; -- (void) addItem:(NSString *)newItem; +- (void) addItem; +- (void) deleteItem; +- (void) markComplete; @end @@ -49,7 +51,7 @@ @implementation Manager { - (void) ToDoHome { - NSLog(@"What would you like to do?\n1- list items\n2- add item\n3- remove item\n4- mark item done\n5- list completed item"); + NSLog(@"What would you like to do?\n1- list items\n2- add item\n3- delete item\n4- mark item done\n5- list completed item"); int i; @@ -69,7 +71,8 @@ - (void) ToDoHome { } if (i == 3) { - NSLog(@"You chose to remove an item"); + NSLog(@"You chose to delete an item"); + [self deleteItem]; } if (i == 4) { @@ -95,34 +98,64 @@ - (void) createList{ // creating list if there is none _yourList = [[NSMutableArray alloc] init]; // initializing array } +- (void) showList{ //Show our list as it is + + int j; + + for (int i = 0; i < [_yourList count]; i++) + { + int numList; + NSLog(@"%d %@",i+1, _yourList[i]); + } + + [self ToDoHome]; +} - - -- (void) addItem{ +- (void) addItem{ //Add item to our list char word; scanf("%s", &word); NSString *_newItem = [NSString stringWithUTF8String:&word]; // converting to string - - [_yourList addObject:_newItem]; // add new item to your list [self ToDoHome]; } - - - -- (void) showList{ +- (void) deleteItem{ //Delete item from our list + NSLog(@"Which item would you like to delete? "); + for (int i = 0; i < [_yourList count]; i++) + { + int numList; + NSLog(@"%d %@",i+1, _yourList[i]); + } - for (int i = 0; i < [_yourList count]; i++) - { - NSLog(@"%@", _yourList[i]); - } - + int k; + scanf("%d", &k); + [_yourList removeObjectAtIndex:k-1]; + NSLog(@"Your updated list is:"); + for (int i = 0; i < [_yourList count]; i++) + { + int numList; + NSLog(@"%d %@",i+1, _yourList[i]); + } [self ToDoHome]; } +- (void) markComplete{ + NSLog(@"Which item is complete? "); + for (int i = 0; i < [_yourList count]; i++) + { + int numList; + NSLog(@"%d %@",i+1, _yourList[i]); + } + + + + [self ToDoHome]; +} + + + @end From 1861393e3af75597dcef77e99214d78aa50e8e32 Mon Sep 17 00:00:00 2001 From: Lauren Date: Sun, 28 Jun 2015 10:25:28 -0400 Subject: [PATCH 07/11] 10:25am commit cool --- TodoList/TodoList/main.m | 66 +++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 385339e..b3bf561 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -39,12 +39,14 @@ - (void) showList; - (void) addItem; - (void) deleteItem; - (void) markComplete; +- (void) completedList; @end @implementation Manager { NSMutableArray *_yourList; + NSMutableArray *_completedList; //NSString *_newItem; } @@ -67,20 +69,22 @@ - (void) ToDoHome { if (i == 2) { NSLog(@"You chose to add an item. Please enter a description:"); [self addItem]; - // scanf(%) } if (i == 3) { - NSLog(@"You chose to delete an item"); + NSLog(@"You chose to delete an item \n"); [self deleteItem]; } if (i == 4) { - NSLog(@"You chose to mark an item as completed"); + NSLog(@"You chose to mark an item as completed: \n"); + [self markComplete]; } if (i == 5 ) { - NSLog(@"You chose to list completed item"); } + NSLog(@"You chose to list completed items: \n"); + [self completedList]; + } } @@ -99,18 +103,18 @@ - (void) createList{ // creating list if there is none } - (void) showList{ //Show our list as it is - - int j; + for (int i = 0; i < [_yourList count]; i++) { - int numList; NSLog(@"%d %@",i+1, _yourList[i]); } [self ToDoHome]; } + + - (void) addItem{ //Add item to our list char word; @@ -122,11 +126,13 @@ - (void) addItem{ //Add item to our list [self ToDoHome]; } + + + - (void) deleteItem{ //Delete item from our list NSLog(@"Which item would you like to delete? "); for (int i = 0; i < [_yourList count]; i++) { - int numList; NSLog(@"%d %@",i+1, _yourList[i]); } @@ -136,27 +142,59 @@ - (void) deleteItem{ //Delete item from our list NSLog(@"Your updated list is:"); for (int i = 0; i < [_yourList count]; i++) { - int numList; + NSLog(@"%d %@",i+1, _yourList[i]); } [self ToDoHome]; } + + + - (void) markComplete{ NSLog(@"Which item is complete? "); for (int i = 0; i < [_yourList count]; i++) { - int numList; + NSLog(@"%d %@",i+1, _yourList[i]); } + int q; + scanf("%d", &q); + NSString *complete = @"complete"; + + [_yourList insertObject:complete atIndex:q-1]; +//[_yourList replaceObjectAtIndex:q-1 withObject:[q-1]@"completed"]; - [self ToDoHome]; + NSLog(@"Your updated list is:"); + for (int i = 0; i < [_yourList count]; i++) + { + + NSLog(@"%d %@",i+1, _yourList[i]); + } + + + + // [self ToDoHome]; } + +- (void) completedList { // creating list if there is none + + _completedList = [[NSMutableArray alloc] init]; // initializing array + + for (int i = 0; i < [_completedList count]; i++) + { + NSLog(@"%d %@",i+1, _completedList[i]); + } + + +} + + @end @@ -193,13 +231,13 @@ int main(int argc, const char * argv[]) { @autoreleasepool { Manager *ListManager = [[Manager alloc]init]; - + [ListManager createList]; [ListManager ToDoHome]; - - + [ListManager completedList]; + From 5ddc337dd8e9cb3261cdb416ec134c28b5608961 Mon Sep 17 00:00:00 2001 From: Jamaal Date: Sun, 28 Jun 2015 12:37:09 -0400 Subject: [PATCH 08/11] commit 12:30pm Sunday --- TodoList/TodoList/main.m | 137 ++++++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 52 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index b3bf561..5438c8d 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -29,8 +29,50 @@ #import -//To Do List Manager +@class Item; +@class Manager; +@class List; +// ************************* Represent To Do Item ************************* + +@interface Item : NSObject +-(void)setNewItem:(NSString *)newItem; + + +@end + +@implementation Item { + NSString *_newItem; +} +-(void)setNewItem:(NSString *)newItem{ + _newItem = newItem; +} + + +@end + + +//************************** Represent To Do List ************************ + +@interface List : NSObject +- (void) setNewList:(NSMutableArray *)newList; + + +@end + +@implementation List{ + NSMutableArray *_newList; +} +- (void) setNewList:(NSMutableArray *)newList{ + _newList = newList; +} + + + +@end + + +//******************************** Manager ********************************* @interface Manager : NSObject - (void) ToDoHome; @@ -38,7 +80,6 @@ - (void) createList; - (void) showList; - (void) addItem; - (void) deleteItem; -- (void) markComplete; - (void) completedList; @end @@ -87,18 +128,13 @@ - (void) ToDoHome { } } - -//} -// - - -//const *char cString = "Hello"; -//NSString *myNSString = [NSString stringWithUTF8String:cString]; - - - (void) createList{ // creating list if there is none + List *newList = [[List alloc] init]; + + [newList setNewList:(_yourList)]; + _yourList = [[NSMutableArray alloc] init]; // initializing array } @@ -113,21 +149,21 @@ - (void) showList{ //Show our list as it is [self ToDoHome]; } - - - (void) addItem{ //Add item to our list char word; scanf("%s", &word); NSString *_newItem = [NSString stringWithUTF8String:&word]; // converting to string + Item *newItem = [[Item alloc] init]; + + [newItem setNewItem:(_newItem)]; + [_yourList addObject:_newItem]; // add new item to your list [self ToDoHome]; - } - - +} - (void) deleteItem{ //Delete item from our list NSLog(@"Which item would you like to delete? "); @@ -148,8 +184,6 @@ - (void) deleteItem{ //Delete item from our list [self ToDoHome]; } - - - (void) markComplete{ NSLog(@"Which item is complete? "); for (int i = 0; i < [_yourList count]; i++) @@ -164,17 +198,12 @@ - (void) markComplete{ [_yourList insertObject:complete atIndex:q-1]; -//[_yourList replaceObjectAtIndex:q-1 withObject:[q-1]@"completed"]; - NSLog(@"Your updated list is:"); for (int i = 0; i < [_yourList count]; i++) { NSLog(@"%d %@",i+1, _yourList[i]); } - - - // [self ToDoHome]; } @@ -198,31 +227,35 @@ - (void) completedList { // creating list if there is none @end +// +////************************** Represent To Do List ************************ +// +//@interface List : NSObject +// +// +//@end +// +//@implementation List +// +// +//@end +// +// - -// Represent To Do List - -@interface ToDoList : NSObject - - -@end - -@implementation ToDoList - -@end - - - - -// Represent To Do Item - -@interface Item : NSObject - -@end - -@implementation Item - -@end +//// ************************* Represent To Do Item ************************* +// +//@interface Item : NSObject +//-(void)setNewItem:(NSString *)newItem; +// +//@end +// +//@implementation Item { +// NSString *_newItem; +//} +//-(void)setNewItem:(NSString *)newItem{ +// _newItem = newItem; +//} +//@end // ============================================================== @@ -230,15 +263,15 @@ @implementation Item int main(int argc, const char * argv[]) { @autoreleasepool { - Manager *ListManager = [[Manager alloc]init]; + Manager *listManager = [[Manager alloc]init]; - [ListManager createList]; + [listManager createList]; - [ListManager ToDoHome]; - - [ListManager completedList]; + [listManager ToDoHome]; + [listManager completedList]; + From 958b390bf7a5296e569dda63563246c41250e6e4 Mon Sep 17 00:00:00 2001 From: Lauren Date: Sun, 28 Jun 2015 16:40:35 -0400 Subject: [PATCH 09/11] commit at 440pm --- TodoList/TodoList/main.m | 188 ++++++++++++++++++++++----------------- 1 file changed, 108 insertions(+), 80 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 5438c8d..3c66c85 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -33,22 +33,32 @@ @class Manager; @class List; + // ************************* Represent To Do Item ************************* @interface Item : NSObject --(void)setNewItem:(NSString *)newItem; +- (void)setNewItem:(NSString *)newItem; + +@property (nonatomic) BOOL completed; @end @implementation Item { + NSString *_newItem; } --(void)setNewItem:(NSString *)newItem{ + + +- (void)setNewItem:(NSString *)newItem{ _newItem = newItem; } + + + + @end @@ -56,13 +66,13 @@ -(void)setNewItem:(NSString *)newItem{ @interface List : NSObject - (void) setNewList:(NSMutableArray *)newList; - - @end + @implementation List{ NSMutableArray *_newList; } + - (void) setNewList:(NSMutableArray *)newList{ _newList = newList; } @@ -80,12 +90,13 @@ - (void) createList; - (void) showList; - (void) addItem; - (void) deleteItem; +- (void) _completedList; - (void) completedList; @end @implementation Manager { - + NSMutableArray *uCompletedList; NSMutableArray *_yourList; NSMutableArray *_completedList; //NSString *_newItem; @@ -94,8 +105,11 @@ @implementation Manager { - (void) ToDoHome { - NSLog(@"What would you like to do?\n1- list items\n2- add item\n3- delete item\n4- mark item done\n5- list completed item"); - + NSLog(@"What would you like to do? \n"); + + NSLog(@"1 | List active items 2 | Add item\n"); + NSLog(@"3 | Delete an item 4 | Mark item completed\n"); + NSLog(@"5 | List completed items \n"); int i; scanf("%d", &i); @@ -103,32 +117,27 @@ - (void) ToDoHome { // for (int j = 0; j < 5; j++) { if (i == 1) { - NSLog(@"You chose to list items"); + NSLog(@"You chose to list your active items: \n"); [self showList]; - } - - if (i == 2) { - NSLog(@"You chose to add an item. Please enter a description:"); + } else if (i == 2) { + NSLog(@"You chose to add an item to the list. Please enter a description: \n"); [self addItem]; - } - - if (i == 3) { - NSLog(@"You chose to delete an item \n"); + } else if (i == 3) { + NSLog(@"You chose to delete an item from the list \n"); [self deleteItem]; - } - - if (i == 4) { + } else if (i == 4) { NSLog(@"You chose to mark an item as completed: \n"); - [self markComplete]; - } - - if (i == 5 ) { + [self markAsCompleted]; + } else if (i == 5 ) { NSLog(@"You chose to list completed items: \n"); - [self completedList]; + [self _completedList]; + } else { + NSLog(@"Invalid Entry"); } } + - (void) createList{ // creating list if there is none List *newList = [[List alloc] init]; @@ -138,14 +147,13 @@ - (void) createList{ // creating list if there is none _yourList = [[NSMutableArray alloc] init]; // initializing array } + - (void) showList{ //Show our list as it is - for (int i = 0; i < [_yourList count]; i++) { - NSLog(@"%d %@",i+1, _yourList[i]); + NSLog(@"%d | %@",i+1, _yourList[i]); } - [self ToDoHome]; } @@ -169,93 +177,115 @@ - (void) deleteItem{ //Delete item from our list NSLog(@"Which item would you like to delete? "); for (int i = 0; i < [_yourList count]; i++) { - NSLog(@"%d %@",i+1, _yourList[i]); + NSLog(@"%d | %@",i+1, _yourList[i]); } int k; scanf("%d", &k); [_yourList removeObjectAtIndex:k-1]; - NSLog(@"Your updated list is:"); + NSLog(@"Your updated active list is:"); for (int i = 0; i < [_yourList count]; i++) { - NSLog(@"%d %@",i+1, _yourList[i]); + NSLog(@"%d | %@",i+1, _yourList[i]); } [self ToDoHome]; } -- (void) markComplete{ - NSLog(@"Which item is complete? "); - for (int i = 0; i < [_yourList count]; i++) - { +// +//- (void) markComplete{ +// NSLog(@"Which item is complete? Enter a number: "); +// for (int i = 0; i < [_yourList count]; i++) +// { +// +// NSLog(@"%d | %@",i+1, _yourList[i]); +// } +// +// int q; +// scanf("%d", &q); +// // self.completed = YES; +// +//} - NSLog(@"%d %@",i+1, _yourList[i]); - } - - int q; - scanf("%d", &q); - NSString *complete = @"complete"; +-(void) completedList { + uCompletedList = [[NSMutableArray alloc] init]; +} - [_yourList insertObject:complete atIndex:q-1]; - - NSLog(@"Your updated list is:"); +- (void) markAsCompleted { //Delete item from our list + NSLog(@"Which item would you like to mark as completed? "); for (int i = 0; i < [_yourList count]; i++) { - - NSLog(@"%d %@",i+1, _yourList[i]); + NSLog(@"%d | %@",i+1, _yourList[i]); } - // [self ToDoHome]; -} - - + NSUInteger q; + scanf("%ld", &q); + [uCompletedList addObjectsFromArray: [_yourList objectAtIndex:q]]; + NSLog(@"%@", uCompletedList[0]); + +// _completedList = [[NSMutableArray alloc] init]; +// +// [_completedList addObject:[_yourList objectAtIndex:q]]; + +// insertObject:myObject atIndex:42 +// +// [_completedList insertObject:completedItem atIndex:q]; +// +// [_completedList addObjectsFromArray: _yourList]; -- (void) completedList { // creating list if there is none +} + + +- (void) _completedList { - _completedList = [[NSMutableArray alloc] init]; // initializing array + NSLog(@"\n Your completed list is: \n"); - for (int i = 0; i < [_completedList count]; i++) + for (int i = 0; i < [uCompletedList count]; i++) { - NSLog(@"%d %@",i+1, _completedList[i]); + NSLog(@"%d | %@ \n",i+1, uCompletedList[i]); } - + [self ToDoHome]; } -@end + +// int q; +// scanf("%d", &q); +// NSString *complete = @"complete"; // -////************************** Represent To Do List ************************ -// -//@interface List : NSObject -// -// -//@end +// [_yourList insertObject:complete atIndex:q-1]; +// +// NSLog(@"Your updated list is:"); +// for (int i = 0; i < [_yourList count]; i++) +// { +// +// NSLog(@"%d %@",i+1, _yourList[i]); +// } + // [self ToDoHome]; + + // -//@implementation List // // -//@end +//- (void) _completedList { // creating list if there is none +// +// _completedList = [[NSMutableArray alloc] init]; // initializing array +// +// for (int i = 0; i < [_completedList count]; i++) +// { +// NSLog(@"%d | %@",i+1, _completedList[i]); +// } +// // +//} // -//// ************************* Represent To Do Item ************************* -// -//@interface Item : NSObject -//-(void)setNewItem:(NSString *)newItem; -// -//@end -// -//@implementation Item { -// NSString *_newItem; -//} -//-(void)setNewItem:(NSString *)newItem{ -// _newItem = newItem; -//} -//@end +@end + // ============================================================== @@ -269,9 +299,7 @@ int main(int argc, const char * argv[]) { [listManager ToDoHome]; - [listManager completedList]; - - + [listManager _completedList]; From 68852c4f1256b7fa7293771d02f1f19c8aa4710c Mon Sep 17 00:00:00 2001 From: Lauren Date: Sun, 28 Jun 2015 18:02:11 -0400 Subject: [PATCH 10/11] 602pm --- TodoList/TodoList/main.m | 49 +++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index 3c66c85..c253197 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -91,14 +91,13 @@ - (void) showList; - (void) addItem; - (void) deleteItem; - (void) _completedList; -- (void) completedList; @end @implementation Manager { - NSMutableArray *uCompletedList; - NSMutableArray *_yourList; + NSMutableArray *_completedList; + NSMutableArray *_yourList; //NSString *_newItem; } @@ -141,9 +140,7 @@ - (void) ToDoHome { - (void) createList{ // creating list if there is none List *newList = [[List alloc] init]; - [newList setNewList:(_yourList)]; - _yourList = [[NSMutableArray alloc] init]; // initializing array } @@ -207,9 +204,6 @@ - (void) deleteItem{ //Delete item from our list // //} --(void) completedList { - uCompletedList = [[NSMutableArray alloc] init]; -} - (void) markAsCompleted { //Delete item from our list NSLog(@"Which item would you like to mark as completed? "); @@ -219,31 +213,44 @@ - (void) markAsCompleted { //Delete item from our lis } - NSUInteger q; - scanf("%ld", &q); - [uCompletedList addObjectsFromArray: [_yourList objectAtIndex:q]]; - NSLog(@"%@", uCompletedList[0]); + int q; + scanf("%d", &q); + fpurge(stdin); + + if (_completedList == nil) { + _completedList = [[NSMutableArray alloc] init]; + } -// _completedList = [[NSMutableArray alloc] init]; -// -// [_completedList addObject:[_yourList objectAtIndex:q]]; +// // remove item at index q from __yourList +// + Item *newItem = [_yourList objectAtIndex:q-1]; -// insertObject:myObject atIndex:42 + [_completedList addObject:newItem]; + [_yourList removeObject:newItem]; +// +// NSLog(@"Your updated active list is : \n %@", _yourList); // -// [_completedList insertObject:completedItem atIndex:q]; +// // add the item to _completedList // -// [_completedList addObjectsFromArray: _yourList]; + + + + + +// [_completedList addObject:[_yourList objectAtIndex:q]]; + +// [_completedList insertObject:completedItem atIndex:0]; + } - (void) _completedList { - NSLog(@"\n Your completed list is: \n"); - for (int i = 0; i < [uCompletedList count]; i++) + for (int i = 0; i < [_completedList count]; i++) { - NSLog(@"%d | %@ \n",i+1, uCompletedList[i]); + NSLog(@"Your completed list is:%d | %@ \n",i+1, _completedList[i]); } [self ToDoHome]; From 1809374e4c0703ed5030deb2130f413a111e8783 Mon Sep 17 00:00:00 2001 From: Jamaal Date: Wed, 1 Jul 2015 19:46:09 -0400 Subject: [PATCH 11/11] submit --- TodoList/TodoList/main.m | 235 ++++++++++++++++++--------------------- 1 file changed, 107 insertions(+), 128 deletions(-) diff --git a/TodoList/TodoList/main.m b/TodoList/TodoList/main.m index c253197..7133055 100644 --- a/TodoList/TodoList/main.m +++ b/TodoList/TodoList/main.m @@ -1,6 +1,8 @@ // // main.m // TodoList + +// LAUREN CAPONONG & JAMAAL SEDAYAO // // Created by Michael Kavouras on 6/25/15. // Copyright (c) 2015 Mike Kavouras. All rights reserved. @@ -34,7 +36,7 @@ @class List; -// ************************* Represent To Do Item ************************* +// ************************* ITEM CLASS ************************* @interface Item : NSObject @@ -54,15 +56,8 @@ - (void)setNewItem:(NSString *)newItem{ _newItem = newItem; } - - - - - @end - - -//************************** Represent To Do List ************************ +//************************** LIST CLASS ************************ @interface List : NSObject - (void) setNewList:(NSMutableArray *)newList; @@ -91,54 +86,71 @@ - (void) showList; - (void) addItem; - (void) deleteItem; - (void) _completedList; +- (void) _incompleteList; +- (void) movePriority; +- (void) editItem; @end @implementation Manager { NSMutableArray *_completedList; + NSMutableArray *_incompleteList; NSMutableArray *_yourList; //NSString *_newItem; - + } - (void) ToDoHome { - NSLog(@"What would you like to do? \n"); - - NSLog(@"1 | List active items 2 | Add item\n"); - NSLog(@"3 | Delete an item 4 | Mark item completed\n"); - NSLog(@"5 | List completed items \n"); + NSLog(@"\nWhat would you like to do?\n1 | List active items\n2 | Add item(useCamelBackWords :)\n3 | Delete an item\n4 | Mark item completed\n5 | List completed items \n6 | Prioritize items \n7 | Edit Item Name"); int i; scanf("%d", &i); - -// for (int j = 0; j < 5; j++) { - if (i == 1) { - NSLog(@"You chose to list your active items: \n"); - [self showList]; - } else if (i == 2) { - NSLog(@"You chose to add an item to the list. Please enter a description: \n"); - [self addItem]; - } else if (i == 3) { - NSLog(@"You chose to delete an item from the list \n"); - [self deleteItem]; - } else if (i == 4) { - NSLog(@"You chose to mark an item as completed: \n"); - [self markAsCompleted]; - } else if (i == 5 ) { - NSLog(@"You chose to list completed items: \n"); - [self _completedList]; - } else { - NSLog(@"Invalid Entry"); - } - - } + if (i == 1) { + NSLog(@"You chose to list your active items: \n"); + [self showList]; + [self ToDoHome]; + } else if (i == 2) { + NSLog(@"You chose to add an item to the list. Please enter a description: \n"); + [self addItem]; + } else if (i == 3) { + NSLog(@"You chose to delete an item from the list \n"); + [self deleteItem]; + } else if (i == 4) { + NSLog(@"You chose to mark an item as completed: \n"); + [self markAsCompleted]; + } else if (i == 5 ) { + NSLog(@"You chose to list completed items: \n"); + [self _completedList]; + } else if (i == 6) { + NSLog(@"Please choose which item needs to be finished first: \n"); + [self movePriority]; + } else if (i == 7) { + NSLog(@"Which item would you like to edit? "); + [self showList]; + int edit; + scanf("%d", &edit); + + NSLog(@"What do you want to replace it with? "); + char word[25]; + scanf("%24s^\n", word); + NSString *_newItem = [NSString stringWithUTF8String:word]; // converting to string + + [_yourList replaceObjectAtIndex:edit-1 withObject:_newItem]; + + [self showList]; + } else { + NSLog(@"Invalid entry, please choose again \n"); + [self ToDoHome]; + } + +} - (void) createList{ // creating list if there is none - + List *newList = [[List alloc] init]; [newList setNewList:(_yourList)]; _yourList = [[NSMutableArray alloc] init]; // initializing array @@ -146,160 +158,127 @@ - (void) createList{ // creating list if there is none } - (void) showList{ //Show our list as it is - + for (int i = 0; i < [_yourList count]; i++) { - NSLog(@"%d | %@",i+1, _yourList[i]); + NSLog(@"%d | %@ \n",i+1, _yourList[i]); } - [self ToDoHome]; } - (void) addItem{ //Add item to our list - - char word; - scanf("%s", &word); - NSString *_newItem = [NSString stringWithUTF8String:&word]; // converting to string + + char word[25]; + scanf("%24s^\n", word); + NSString *_newItem = [NSString stringWithUTF8String:word]; // converting to string Item *newItem = [[Item alloc] init]; [newItem setNewItem:(_newItem)]; - [_yourList addObject:_newItem]; // add new item to your list + [_yourList addObject:_newItem]; // add new item to your list [self ToDoHome]; } -- (void) deleteItem{ //Delete item from our list - NSLog(@"Which item would you like to delete? "); +- (void) deleteItem{ //Delete item from our list + NSLog(@"Which item would you like to delete? \n"); for (int i = 0; i < [_yourList count]; i++) { - NSLog(@"%d | %@",i+1, _yourList[i]); + NSLog(@"%d | %@ \n",i+1, _yourList[i]); } int k; scanf("%d", &k); [_yourList removeObjectAtIndex:k-1]; - NSLog(@"Your updated active list is:"); + NSLog(@"Your updated active list is: \n"); for (int i = 0; i < [_yourList count]; i++) { - - NSLog(@"%d | %@",i+1, _yourList[i]); + + NSLog(@"%d | %@ \n",i+1, _yourList[i]); } [self ToDoHome]; } - -// -//- (void) markComplete{ -// NSLog(@"Which item is complete? Enter a number: "); -// for (int i = 0; i < [_yourList count]; i++) -// { -// -// NSLog(@"%d | %@",i+1, _yourList[i]); -// } -// -// int q; -// scanf("%d", &q); -// // self.completed = YES; -// -//} +- (void) editItem:(Item *)newItem + atIndex:(NSInteger)j{ + + //[_yourList replaceObjectAtIndex:<#(NSUInteger)#> withObject:<#(id)#>] + + [self showList]; +} +- (void) movePriority{ //move priority to first + + for (int i = 0; i < [_yourList count]; i++) + { + NSLog(@"%d | %@ \n",i+1, _yourList[i]); + } + + int z; + scanf("%d", &z); + [_yourList exchangeObjectAtIndex:0 withObjectAtIndex:z-1]; + + NSLog(@"Your updated active list is: \n"); + + for (int i = 0; i < [_yourList count]; i++) + { + + NSLog(@"%d | %@ \n",i+1, _yourList[i]); + } + [self ToDoHome]; + +} - (void) markAsCompleted { //Delete item from our list - NSLog(@"Which item would you like to mark as completed? "); + NSLog(@"Which item would you like to mark as completed? \n"); for (int i = 0; i < [_yourList count]; i++) { NSLog(@"%d | %@",i+1, _yourList[i]); } - - + + int q; scanf("%d", &q); fpurge(stdin); - + if (_completedList == nil) { _completedList = [[NSMutableArray alloc] init]; } -// // remove item at index q from __yourList -// Item *newItem = [_yourList objectAtIndex:q-1]; [_completedList addObject:newItem]; [_yourList removeObject:newItem]; -// -// NSLog(@"Your updated active list is : \n %@", _yourList); -// -// // add the item to _completedList -// - - - - - -// [_completedList addObject:[_yourList objectAtIndex:q]]; - -// [_completedList insertObject:completedItem atIndex:0]; +} -} - - - (void) _completedList { for (int i = 0; i < [_completedList count]; i++) { - NSLog(@"Your completed list is:%d | %@ \n",i+1, _completedList[i]); + NSLog(@"Your completed list is:\n%d | %@ \n\n",i+1, _completedList[i]); } [self ToDoHome]; } - - - -// int q; -// scanf("%d", &q); -// NSString *complete = @"complete"; -// -// [_yourList insertObject:complete atIndex:q-1]; -// -// NSLog(@"Your updated list is:"); -// for (int i = 0; i < [_yourList count]; i++) -// { -// -// NSLog(@"%d %@",i+1, _yourList[i]); -// } - // [self ToDoHome]; - - -// -// -// -//- (void) _completedList { // creating list if there is none -// -// _completedList = [[NSMutableArray alloc] init]; // initializing array -// -// for (int i = 0; i < [_completedList count]; i++) -// { -// NSLog(@"%d | %@",i+1, _completedList[i]); -// } -// -// -//} -// - +- (void) _incompleteList { + for (int i = 0; i < [_yourList count]; i++) + { + NSLog(@"Your active tasks are:\n%d | %@ \n\n", i + 1, _yourList); + } +} @end - - // ============================================================== int main(int argc, const char * argv[]) { @autoreleasepool { - + + NSLog(@"\n::::::::::::::::::blist::::::::::::::::::::"); + Manager *listManager = [[Manager alloc]init]; [listManager createList]; @@ -312,4 +291,4 @@ int main(int argc, const char * argv[]) { } return 0; -} +} \ No newline at end of file