//
// main.m
// Flim
//
/*
可以表述出海报内容
类名:Film
影片名字 内容 上映时间
展示图片
*/
#import <Foundation/Foundation.h>
#import "Film.h"
int main(int argc, const char * argv[])
{
Film * film = [Film new];
//NSLog(@"%@",film);
film->_singelPrice = 55;
film->_flimName = @"向左走向右走";
film->_directorName = @"陈凯歌";
film->_amountOfFilmTicket = 5;
film->_castName = @"小猪 小狗 小猫咪";
[film filmWithPlayTime:selectWatchFilmTimeSunday];
NSLog(@"影片名称=%@ 上映时间=%@ 导演的名字=%@ 演员阵容的名字=%@ 电影票的价格=%d 选取电影票的数量=%d ", film->_flimName,film->_showDateTime,film->_directorName,film->_castName,film->_singelPrice,film->_amountOfFilmTicket);
//NSLog(@"%@",film);
@autoreleasepool {
// insert code here...
//NSLog(@"Hello, World!");
}
return 0;
}
//
// Film.h
// Flim
//
#import <Foundation/Foundation.h>
enum selectWatchFilmTime
{
selectWatchFilmTimeMonday,//用来记录观看时间周一观看
selectWatchFilmTimeThesday,//用来记录观看时间周二观看
selectWatchFilmTimeWednesday,//用来记录观看时间周三观看
selectWatchFilmTimeThursday,//用来记录观看时间周四观看
selectWatchFilmTimeFriday,//用来记录观看时间周五观看
selectWatchFilmTimeSaturday,//用来记录观看时间周六观看
selectWatchFilmTimeSunday//用来记录观看时间周日观看
};
typedef enum selectWatchFilmTime selectWatchFilmTime;
@interface Film : NSObject
{
@public
/**用来存储电影的影片名称*/
NSString * _flimName;
/**用来存储电影的上映时间*/
NSString * _showDateTime;
/**用来存储导演的名字*/
NSString * _directorName;
/**用来存储演员阵容的名字*/
NSString * _castName;
/**用来存储电影票的价格*/
int _singelPrice;
/**用来记录选取电影票的数量*/
int _amountOfFilmTicket;
/**选取看电影时间*/
selectWatchFilmTime _selselectWatchFilmTime;
}
//setter方法
-(void)setSelectAmountOfFimeTicket:(int)amountOfTicket;
//关于电影
-(void)aboutTheFilm;
//电影的内容
-(void)aboutTheFilmContent:(char *)content;
//选取电影票数
-(void)selectAmountOfFilmTicket:(int)selectNumber;
//观看电影时间选取
-(void)filmWithPlayTime:(selectWatchFilmTime)selectWatchFilmTime;
-(NSString *)description;
@end
//
// Film.m
// Flim
#import "Film.h"
@implementation Film
//setter方法
-(void)setSelectAmountOfFimeTicket:(int)amountOfTicket
{
_amountOfFilmTicket = amountOfTicket;
}
//关于电影
-(void)aboutTheFilm
{
NSLog(@"you can konwn about the film");
}
//电影的内容
-(void)aboutTheFilmContent:(char *)content
{
NSLog(@"show the film content ");
}
//选取电影票数
-(void)selectAmountOfFilmTicket:(int)selectNumber
{
NSLog(@"电影票数量");
}
//观看电影时间选取
-(void)filmWithPlayTime:(selectWatchFilmTime)selectWatchFilmTime
{
switch (selectWatchFilmTime) {
case selectWatchFilmTimeMonday:
NSLog(@"观看时间周一");
break;
case selectWatchFilmTimeThesday:
NSLog(@"观看时间周二");
break;
case selectWatchFilmTimeWednesday:
NSLog(@"观看时间周三");
break;
case selectWatchFilmTimeThursday:
NSLog(@"观看时间周四");
break;
case selectWatchFilmTimeFriday:
NSLog(@"观看时间周五");
break;
case selectWatchFilmTimeSaturday:
NSLog(@"观看时间周六");
break;
case selectWatchFilmTimeSunday:
NSLog(@"观看时间周日");
break;
default:
NSLog(@"请又一次选取");
break;
}
}
//重写description方法
-(NSString *)description
{
return [NSString stringWithFormat:@"影片名称=%@ 上映时间=%@ 导演的名字=%@ 演员阵容的名字=%@ 电影票的价格=%d 选取电影票的数量=%d ", _flimName,_showDateTime,_directorName,_castName,_singelPrice,_amountOfFilmTicket];
}
@end