main.m// flim///* can express the contents of the Sea newspaper class name: Film movie name content release time display picture */#import <foundation/foundation.h># Import "Film.h" int main (int argc, const char * argv[]) { Film * Film = [Film new]; NSLog (@ "%@", film); Film->_singelprice =; Film->_flimname = @ "Go left to right"; Film->_directorname = @ "Chen Kai"; Film->_amountoffilmticket = 5; Film->_castname = @ "Little pig Puppy Kitten"; [film Filmwithplaytime:selectwatchfilmtimesunday]; NSLog (@ "Film name =%@ release time =%@ director's name =%@ cast name =%@ movie ticket price =%d Select the number of movie tickets =%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,// Used to record viewing time Monday watch selectwatchfilmtimethesday,//used to record viewing time Tuesday watch selectwatchfilmtimewednesday,//used to record viewing time Wednesday watch Selectwatchfil mtimethursday,//used to record viewing time Thursday watch selectwatchfilmtimefriday,//used to record viewing time Friday watch selectwatchfilmtimesaturday,//used to record viewing time Saturday watch selectwatchfilmtimesunday//used to record viewing time Sunday watch};typedef enum selectwatchfilmtime selectwatchfilmtime; @interface film:nsob ject{@public/** The name of the film used to store the movie */NSString * _FLIMNAME; /** used to store the release time of the film * * NSString * _SHOWDATETIME; /** used to store the director's name * * NSString * _DIRECTORNAME; /** used to store the name of the cast, * * NSString * _CASTNAME; /** used to store the price of movie tickets */int _singelprice; /** used to record the number of selected movie tickets */int _amountoffilmticket; /** choose to see the movie time * * Selectwatchfilmtime _selselectwatchfilmtime; }//setter Method-(void) Setselectamountoffimeticket: (int) amountofticket;//about movie-(void) aboutthefilm;//movie content-(void) Aboutthefilmcontent: (Char *) content;//Select movie Ticket number-(void) Selectamountoffilmticket: (int) selectnumber;//Watch Movie Time Selection-(void) Filmwithplaytime: ( Selectwatchfilmtime) selectwatchfilmtime;-(NSString *) description; @end
film.m//flim#import "Film.h" @implementation Film//setter Method-(void) Setselectamountoffimeticket: (int) amountofticket{_amountoffilmticket = Amountofticket;} About the film-(void) aboutthefilm{NSLog (@ "You can konwn about the film"); }//movie Content-(void) Aboutthefilmcontent: (char *) content{NSLog (@ "Show the film Content");} Select the number of movie votes-(void) Selectamountoffilmticket: (int) selectnumber{NSLog (@ "Number of movie tickets");} Watch movie Time Selection-(void) Filmwithplaytime: (selectwatchfilmtime) selectwatchfilmtime{switch (selectwatchfilmtime) {case Selectwatchfilmtimemonday:nslog (@ "Viewing time Monday"); Break Case Selectwatchfilmtimethesday:nslog (@ "Viewing time Tuesday"); Break Case Selectwatchfilmtimewednesday:nslog (@ "Viewing time Wednesday"); Break Case Selectwatchfilmtimethursday:nslog (@ "Viewing time Thursday"); Break Case Selectwatchfilmtimefriday:nslog (@ "Viewing time Friday"); Break Case SelectwatchfilmtimesaturdaY:nslog (@ "Viewing time Saturday"); Break Case Selectwatchfilmtimesunday:nslog (@ "Viewing time Sunday"); Break Default:nslog (@ "Please re-select"); Break }}//Rewrite Description Method-(NSString *) description{return [NSString stringwithformat:@ "movie name =%@ release Time =%@ director's name =%@ cast name =%@ power The price of the ticket =%d select the number of movie tickets =%d ", _flimname,_showdatetime,_directorname,_castname,_singelprice,_amountoffilmticket];} @end
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Design a movie class print out the contents of the poster