diff --git a/Week2/APLOCWeek2/APLOCWeek2.xcodeproj/project.xcworkspace/xcuserdata/notmyemail.xcuserdatad/UserInterfaceState.xcuserstate b/Week2/APLOCWeek2/APLOCWeek2.xcodeproj/project.xcworkspace/xcuserdata/notmyemail.xcuserdatad/UserInterfaceState.xcuserstate index dceb159..423360f 100644 Binary files a/Week2/APLOCWeek2/APLOCWeek2.xcodeproj/project.xcworkspace/xcuserdata/notmyemail.xcuserdatad/UserInterfaceState.xcuserstate and b/Week2/APLOCWeek2/APLOCWeek2.xcodeproj/project.xcworkspace/xcuserdata/notmyemail.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Week2/APLOCWeek2/APLOCWeek2/ViewController.m b/Week2/APLOCWeek2/APLOCWeek2/ViewController.m index d3c74f1..92f95fd 100644 --- a/Week2/APLOCWeek2/APLOCWeek2/ViewController.m +++ b/Week2/APLOCWeek2/APLOCWeek2/ViewController.m @@ -17,10 +17,44 @@ -(IBAction)onCompeteClick:(id)sender { - swimEvent *newSwimEvent = (swimEvent*)[eventFactory createNewEvent:SWIM]; - [newSwimEvent setWaterTemp: 70]; - textBox.text = [NSString stringWithFormat:@"Event Time of %.2f Minutes", [newSwimEvent calculateEventTime]]; + if (swimButton.enabled == FALSE) + { + swimEvent *newSwimEvent = (swimEvent*)[eventFactory createNewEvent:SWIM]; + [newSwimEvent setWaterTemp: 70]; + [newSwimEvent setEventDistance:stepperControl.value]; + + textBox.text = [NSString stringWithFormat:@"Event Time ~ %.4f Minutes", [newSwimEvent calculateEventTime]]; + + swimButton.enabled = TRUE; + stepperControl.enabled = FALSE; + } + else if (bikeButton.enabled == FALSE) + { + bikeEvent *newBikeEvent = (bikeEvent*)[eventFactory createNewEvent:BIKE]; + [newBikeEvent setElevationInFeet:2375]; + [newBikeEvent setEventDistance:stepperControl.value]; + + + textBox.text = [NSString stringWithFormat:@"Event Time ~ %.4f Minutes", [newBikeEvent calculateEventTime]]; + + bikeButton.enabled = TRUE; + stepperControl.enabled = FALSE; + } + else + { + runEvent *newRunEvent = (runEvent*)[eventFactory createNewEvent:RUN]; + [newRunEvent setTerrainType:PAVEDESTREETS]; + [newRunEvent setEventDistance:stepperControl.value]; + + + textBox.text = [NSString stringWithFormat:@"Event Time ~ %.4f Minutes", [newRunEvent calculateEventTime]]; + + runButton.enabled = TRUE; + stepperControl.enabled = FALSE; + } + + competeButton.enabled = FALSE; } @@ -36,6 +70,7 @@ runButton.enabled = TRUE; bikeButton.enabled = TRUE; stepperControl.value = 0; + competeButton.enabled = TRUE; } else if (classButton.tag == 1) { @@ -46,6 +81,7 @@ runButton.enabled = TRUE; swimButton.enabled = TRUE; stepperControl.value = 0; + competeButton.enabled = TRUE; } else if (classButton.tag == 2) @@ -57,6 +93,7 @@ swimButton.enabled = TRUE; bikeButton.enabled = TRUE; stepperControl.value = 0; + competeButton.enabled = TRUE; } } diff --git a/Week2/APLOCWeek2/APLOCWeek2/bikeEvent.m b/Week2/APLOCWeek2/APLOCWeek2/bikeEvent.m index 30c1efc..30ce690 100644 --- a/Week2/APLOCWeek2/APLOCWeek2/bikeEvent.m +++ b/Week2/APLOCWeek2/APLOCWeek2/bikeEvent.m @@ -35,7 +35,7 @@ float handicap; float distanceHandicap; - handicap = abs(25 - elevationInFeet) * 0.01 * abs(25 - elevationInFeet); + handicap = abs(25 - elevationInFeet) * 0.001; distanceHandicap = 2 * (eventDistance * 1.05); [self setEventTimeInMinutes:(handicap + distanceHandicap)]; diff --git a/Week2/APLOCWeek2/APLOCWeek2/en.lproj/ViewController_iPhone.xib b/Week2/APLOCWeek2/APLOCWeek2/en.lproj/ViewController_iPhone.xib index 0958a9e..d404a34 100644 --- a/Week2/APLOCWeek2/APLOCWeek2/en.lproj/ViewController_iPhone.xib +++ b/Week2/APLOCWeek2/APLOCWeek2/en.lproj/ViewController_iPhone.xib @@ -39,7 +39,7 @@ 274 - + 292 {{0, 519}, {320, 30}} @@ -77,13 +77,13 @@ - + 292 {{247, 0}, {73, 33}} - + _NS:9 NO IBCocoaTouchFramework @@ -91,7 +91,7 @@ 0 1 Info - + 3 MQA @@ -99,27 +99,27 @@ 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - + 3 MC41AA - + 2 15 - + Helvetica-Bold 15 16 - + 292 {{20, 80}, {280, 30}} - + _NS:9 NO YES @@ -132,7 +132,7 @@ 3 MAA - + 2 @@ -151,13 +151,13 @@ 16 - + 268 {{109, 118}, {94, 27}} - + _NS:9 NO YES @@ -170,13 +170,13 @@ 1 10 - + 292 {{20, 164}, {86, 44}} - + _NS:9 NO IBCocoaTouchFramework @@ -184,22 +184,22 @@ 0 1 Swim - + 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - + + + - + 292 {{207, 164}, {85, 44}} - + _NS:9 NO 2 @@ -208,22 +208,22 @@ 0 1 Run - + 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - + + + - + 292 {{114, 164}, {85, 44}} - + _NS:9 NO 1 @@ -232,46 +232,47 @@ 0 1 Bike - + 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - + + + - + 292 {{20, 416}, {280, 44}} - + _NS:9 NO IBCocoaTouchFramework + NO 0 0 1 Compete - + 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - + + {{0, 20}, {320, 548}} - + 3 MC43NQA - + NO @@ -309,7 +310,7 @@ segmentControl - + 15 @@ -317,7 +318,7 @@ stepperControl - + 85 @@ -325,7 +326,7 @@ textBox - + 93 @@ -333,7 +334,7 @@ swimButton - + 105 @@ -341,7 +342,7 @@ runButton - + 106 @@ -349,7 +350,7 @@ bikeButton - + 107 @@ -357,14 +358,14 @@ competeButton - + 108 onChange: - + 13 @@ -373,7 +374,7 @@ onClick: - + 7 @@ -382,7 +383,7 @@ onStepChange: - + 13 @@ -391,7 +392,7 @@ onClassButtonClick: - + 7 @@ -400,7 +401,7 @@ onClassButtonClick: - + 7 @@ -409,7 +410,7 @@ onClassButtonClick: - + 7 @@ -418,7 +419,7 @@ onCompeteClick: - + 7 @@ -448,8 +449,8 @@ 6 - - + + 6 0 @@ -464,8 +465,8 @@ 29 3 - - + + 5 0 @@ -480,8 +481,8 @@ 29 3 - - + + 4 0 @@ -496,8 +497,8 @@ 29 3 - - + + 5 0 @@ -512,11 +513,11 @@ 29 3 - + 6 0 - + 6 1 @@ -528,11 +529,11 @@ 29 3 - + 4 0 - + 4 1 @@ -544,11 +545,11 @@ 9 3 - - + + 5 0 - + 6 1 @@ -560,11 +561,11 @@ 24 3 - - + + 11 0 - + 11 1 @@ -576,8 +577,8 @@ 24 2 - - + + 3 0 @@ -592,8 +593,8 @@ 29 3 - - + + 6 0 @@ -608,11 +609,11 @@ 29 3 - - + + 9 0 - + 9 1 @@ -624,11 +625,11 @@ 24 2 - - + + 11 0 - + 11 1 @@ -640,11 +641,11 @@ 24 2 - - + + 5 0 - + 6 1 @@ -656,8 +657,8 @@ 24 3 - - + + 3 0 @@ -672,8 +673,8 @@ 9 3 - - + + 5 0 @@ -688,11 +689,11 @@ 29 3 - - + + 3 0 - + 4 1 @@ -704,8 +705,8 @@ 24 3 - - + + 5 0 @@ -720,8 +721,8 @@ 29 3 - - + + 3 0 @@ -736,11 +737,11 @@ 9 3 - + 6 0 - + 6 1 @@ -752,43 +753,43 @@ 29 3 - - - - - - - - + + + + + + + + 8 - + 14 - + 13 - + 11 - + 18 - + - - + + 8 0 @@ -798,13 +799,13 @@ 32 1000 - + 3 9 1 - - + + 7 0 @@ -814,7 +815,7 @@ 73 1000 - + 3 9 1 @@ -824,52 +825,52 @@ 21 - + 22 - + 24 - - + + 26 - - + + 28 - + 36 - + 37 - + 38 - + 46 - + - - + + 7 0 @@ -879,7 +880,7 @@ 86 1000 - + 3 9 1 @@ -889,20 +890,20 @@ 49 - + 50 - + 51 - + - - + + 7 0 @@ -912,7 +913,7 @@ 85 1000 - + 3 9 1 @@ -922,10 +923,10 @@ 54 - + - - + + 7 0 @@ -935,7 +936,7 @@ 85 1000 - + 3 9 1 @@ -945,73 +946,73 @@ 65 - + 72 - + 74 - + 81 - + 83 - + 78 - + 66 - + 100 - - + + 102 - + 103 - - + + 104 - - + + 110 - + 111 - + 113 - + @@ -1033,8 +1034,8 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -1049,42 +1050,42 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin - + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - + com.apple.InterfaceBuilder.IBCocoaTouchPlugin - + com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin