main.m// E-coupon//#import <Foundation/Foundation.h> #import "Discount.h" #import "Food.h" int main ( int argc, const char * argv[]) { Discount * dis = [[Discount alloc]init]; [Dis showinformation:20 anddiscounttime:@] This coupon is used after 10:30 daily to use the "andcontentinformation:@" coupon only for McDonald's restaurants selling coupon products in mainland China , the specific notice in the store, the validity of December 4, 2013-December 30, 2013, alteration or damage is invalid; Food in kind, the image for reference only; this coupon is not suitable for room service; except food, other items (including containers) are not covered by the sale This coupon cannot be used in conjunction with other promotional offers. @autoreleasepool { //Insert code here ... NSLog (@ "Hello, world!"); } return 0;}
discount.h// E-coupon//#import <Foundation/Foundation.h> @interface discount:nsobject{ /** Used to record discounted price */ int _price; /** used to record the time of discounted use * * NSString * _discounttime; /** Final Interpretation Rights information */ NSString * _contentinformation;} @property int price; @property NSString * discounttime; @property NSString * contentinformation;-(void) Showinformation: ( int) Price Anddiscounttime: (NSString *) discounttime andcontentinformation: (NSString *) contentinformation; @end
////discount.m//e-coupon//#import "Discount.h" @implementation discount@synthesize Price = _price; @synthesize discounttime = _discounttime; @synthesize contentinformation = _contentinformation;-(void) Showinformation: (int) Price anddiscounttime: (NSString *) discounttime andcontentinformation: (NSString *) contentinformation{_price = Price; _discounttime = Discounttime; _contentinformation = contentinformation; NSLog (@ "Price:%d discount Time:%@ Detailed Description:%@", _price,_discounttime,_contentinformation);} -(NSString *) description{return [NSString stringwithformat:@ "Price:%d discount time:%@ details%@", _price,_discounttime,_ Contentinformation];} @end
food.h// E-coupon//#import <Foundation/Foundation.h> @interface food:nsobject{ /** to record the name of the dish * * NSString * _FOODNAME; /** Composition Material */NSString * _material; /** Nutrition Information * * NSString * _nutrition; /** used to record food types * * NSString * _kindoffood;} @property NSString * foodname; @property nsstring * material; @property nsstring * NUTRITION; @property NSString * Kindoffood ;-(void) Showinformation: (nsstring*) foodname andshowmaterial: (NSString *) material andshownurition: (NSString *) Nutrition; @end
food.m// E-coupon//#import "Food.h" @implementation food@synthesize foodname = _foodname; @synthesize material = _material; @synthesize nutrition = _nutrition; @synthesize kindoffood = _kindoffood;-(void) Showinformation: ( nsstring*) foodname andshowmaterial: (NSString *) material andshownurition: (NSString *) nutrition; { _foodname = foodname; _material = material; _nutrition = nutrition; NSLog (@ "%@%@%@", _foodname,_material,_nutrition);} -(NSString *) description{ return [nsstring stringwithformat:@ "Food Name:%@ Ingredients:%@ Nutrients:%@", _foodname,_material,_ Nutrition];} @end
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Design and implementation of electronic coupon for iOS development