Created
March 17, 2009 03:59
-
-
Save tatey/80275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Main module for verifying Distance. Prints results to STDOUT | |
*/ | |
#import "Distance.h" | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
// Initalise three instances. | |
id d1 = [[Distance alloc] init]; | |
id d2 = [[Distance alloc] init]; | |
id d3 = [[Distance alloc] init]; | |
// Set attributes | |
[d1 setPlaceA: "Brisbane"]; | |
[d1 setPlaceB: "Sydney"]; | |
[d1 setDistanceBetweenPlaces: 925]; | |
[d2 setPlaceA: "Nathan"]; | |
[d2 setPlaceB: "Logan"]; | |
[d2 setDistanceBetweenPlaces: 10.9]; | |
[d3 setPlaceA: "Nathan"]; | |
[d3 setPlaceB: "Gold Coast"]; | |
[d3 setDistanceBetweenPlaces: 95.4]; | |
float speedInKilometersPerHour = 80.0; | |
// Print result of each method call to STDOUT | |
printf( | |
"Travel time at %.0f KM/h between %s and %s is %.0f minutes\n", | |
speedInKilometersPerHour, | |
[d1 placeA], | |
[d1 placeB], | |
[d1 travelTimeAtSpeed: speedInKilometersPerHour] | |
); | |
printf( | |
"Travel time at %.0f KM/h between %s and %s is %.0f minutes\n", | |
speedInKilometersPerHour, | |
[d2 placeA], | |
[d2 placeB], | |
[d2 travelTimeAtSpeed: speedInKilometersPerHour] | |
); | |
printf( | |
"Travel time at %.0f KM/h between %s and %s is %.0f minutes\n", | |
speedInKilometersPerHour, | |
[d3 placeA], | |
[d3 placeB], | |
[d3 travelTimeAtSpeed: speedInKilometersPerHour] | |
); | |
// Beer for everyone (Your shout)! | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment