ios開發之電子優惠券的設計與實現

來源:互聯網
上載者:User

ios開發之電子優惠券的設計與實現

////  main.m//  電子優惠券//#import #import Discount.h#import Food.hint main(int argc, const char * argv[]){    Discount * dis = [[Discount alloc]init];        [dis showInformation:20 andDiscountTime:@本優惠券每日上午10:30之後使用 andContentInformation:@本優惠券僅限在中國大陸地區售賣優惠券產品的麥當勞餐廳使用,具體以本店內公示為準,有效期間2013年12月4日-2013年12月30日;塗改或損壞無效;食品以實物為準,圖片僅供參考;本優惠券不合適用於送餐服務;除食物外,其他物品(包括容器)不在售賣範圍;本優惠券不能與其他優惠活動同時使用];        @autoreleasepool {                // insert code here...        NSLog(@Hello, World!);            }    return 0;}
////  Discount.h//  電子優惠券//#import @interface Discount : NSObject{    /**用來記錄打折價格*/    int _price;        /**用來記錄打折使用的時間*/    NSString * _discountTime;        /**最終解釋權資訊*/    NSString * _contentInformation;}@property int price;@property NSString * discountTime;@property NSString * contentInformation;-(void)showInformation:(int)price andDiscountTime:(NSString *)discountTime andContentInformation:(NSString *)contentInformation;@end

////  Discount.m//  電子優惠券//#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(@價格:%d 打折時間:%@ 詳細介紹:%@,_price,_discountTime,_contentInformation);}-(NSString *)description{    return [NSString stringWithFormat:@價格:%d 打折時間:%@ 詳細資料%@,_price,_discountTime,_contentInformation];}@end
////  Food.h//  電子優惠券//#import @interface Food : NSObject{    /**用來記錄菜品名稱*/    NSString * _foodName;        /**組成材料*/    NSString * _material;        /**營養資訊*/    NSString * _nutrition;        /**用來記錄食品種類*/    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//  電子優惠券//#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:@食品名稱:%@食材:%@ 營養物質:%@,_foodName,_material,_nutrition];}@end


 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.