2015-11-24-objective-c-----OC_NO.作业

2015-11-25 18:55:10

//
// main.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

import "Car_1.h"

import "Phone_2.h"

import "Cup_3.h"

import "computer_4.h"

import "air conditioning_5.h"

import "computer keyboard_6.h"

import "mouse_7.h"

import "LCD_8.h"

import "USB_9.h"

import "monitor unit_10.h"

import "Class_2_1.h"

import "Teacher_2_2.h"

import "Student_2_3.h"

int main(int argc, const char * argv[]) {
/*

定义10个类: 1、声明:实例变量、方法。实现:初始化方法、自定义方法、自我
介绍方法。(方法实现时,以NSLog输出即可)
2、在main.m中分别创建10个类的对象。 3、给对象的实例变量进行赋值、取值操作,执行方法。

*/

if 0

Car_1 *a = [[Car_1 alloc] init];
[a setAndGet1];
Phone_2 *b = [[Phone_2 alloc] init];
[b steAndGet2];
Cup_3 *c = [[Cup_3 alloc] init];
[c setAndGet3];
computer_4 *d = [[computer_4 alloc] init];
[d setAndGet4];
air_conditioning_5 *e = [[air_conditioning_5 alloc] init];
[e setandget_5];
computer_keyboard_6 *f = [[computer_keyboard_6 alloc] init];
[f setandget6];
mouse_7 *g = [[mouse_7 alloc] init];
[g setandget7];
LCD_8 *h = [[LCD_8 alloc] init];
[h setandget8];
USB_9 *i = [[USB_9 alloc] init];
[i setandget9];
monitor_unit_10 *j = [[monitor_unit_10 alloc] init];
[j setandget10];

endif

/*
完成蓝鸥班级开班仪式流程:
1.早9:00开班仪式开始。(NSLog(@“开班仪式正式开始”))
2.Marry老师做自我介绍。
3.三名学生做自我介绍。
要求 :
1.定义一个班级类。
实例变量:所属培训机构名称,班级名,班级人数,授课老师名字,开班日期。
方法:设置学校名字:蓝鸥、集体活动,开班仪式。
2.定义一个老师类。
实例变量:名字、性别、年龄、正在教的课程、正在授课班级。
方法: 讲课、布置作业、验收作业、解决问题、自我介绍。
3.定义一个学生类。
实例变量:名字、性别、年龄、学号、班级名、任课老师、正在学习的课程。
方法:学习、做作业、提出问题、回答问题、自我介绍
注:方法以NSLog输出为主。
*/
Class_2_1 *k = [[Class_2_1 alloc] init];
[k a];
[k b];
[k c];
Teacher_2_2 *l = [[Teacher_2_2 alloc] init];
[l b5];
Student_2_3 *n = [[Student_2_3 alloc] init];
[n c5];
return 0;

}



//
// Student_2_3.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface Student_2_3 : NSObject
{

NSString *_Student_2_3Name;
NSString *_Student_2_3Sxe;
NSString *_Student_2_3Age;
NSString *_Student_2_3XueHao;
NSString *_Student_2_3Class;
NSString *_Student_2_3Teacher;
NSString *_Student_2_3Course;

}

  • (void)c1;
  • (void)c2;
  • (void)c3;
  • (void)c4;
  • (void)c5;

@end


//
// Student_2_3.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "Student_2_3.h"

@implementation Student_2_3

  • (void)c1
    {

    NSLog(@"学习");

    }

  • (void)c2
    {

    NSLog(@"");

    }

  • (void)c3
    {

    NSLog(@"");

    }

  • (void)c4
    {

    NSLog(@"");

    }

  • (void)c5
    {

    _Student_2_3Name = @"12";
    _Student_2_3Sxe = @"m";
    _Student_2_3Age = @"32";
    _Student_2_3XueHao = @"1";
    _Student_2_3Class = @"1";
    _Student_2_3Teacher = @"marry";
    _Student_2_3Course = @"OC";
    NSLog(@"我是%@性别%@今年%@学号是%@班级是%@老师是%@课程是%@", _Student_2_3Name, _Student_2_3Sxe, _Student_2_3Age, _Student_2_3XueHao, _Student_2_3Class, _Student_2_3Teacher, _Student_2_3Course);
    
    _Student_2_3Name = @"13";
    _Student_2_3Sxe = @"m";
    _Student_2_3Age = @"21";
    _Student_2_3XueHao = @"2";
    _Student_2_3Class = @"1";
    _Student_2_3Teacher = @"marry";
    _Student_2_3Course = @"OC";
    NSLog(@"我是%@性别%@今年%@学号是%@班级是%@老师是%@课程是%@", _Student_2_3Name, _Student_2_3Sxe, _Student_2_3Age, _Student_2_3XueHao, _Student_2_3Class, _Student_2_3Teacher, _Student_2_3Course);
    
    _Student_2_3Name = @"14";
    _Student_2_3Sxe = @"m";
    _Student_2_3Age = @"22";
    _Student_2_3XueHao = @"3";
    _Student_2_3Class = @"1";
    _Student_2_3Teacher = @"marry";
    _Student_2_3Course = @"OC";
    NSLog(@"我是%@性别%@今年%@学号是%@班级是%@老师是%@课程是%@", _Student_2_3Name, _Student_2_3Sxe, _Student_2_3Age, _Student_2_3XueHao, _Student_2_3Class, _Student_2_3Teacher, _Student_2_3Course);

    }

@end



//
// Teacher_2_2.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface Teacher_2_2 : NSObject
{

NSString *_Teacher_2_2Name;
NSString *_Teacher_2_2Sex;
NSString *_Teacher_2_2Age;
NSString *_Teacher_2_2Course;
NSString *_Teacher_2_2Class;

}

  • (void)b1;
  • (void)b2;
  • (void)b3;
  • (void)b4;
  • (void)b5;
    @end

//
// Teacher_2_2.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "Teacher_2_2.h"

@implementation Teacher_2_2

  • (void)b1
    {

    NSLog(@"讲课");

    }

  • (void)b2
    {

    NSLog(@"布置作业");

    }

  • (void)b3
    {

    NSLog(@"查看作业");

    }

  • (void)b4
    {

    NSLog(@"解决问题");

    }

  • (void)b5
    {

    _Teacher_2_2Name  = @"Marry";
    _Teacher_2_2Sex = @"男";
    _Teacher_2_2Age = @"24";
    _Teacher_2_2Course = @"OC";
    _Teacher_2_2Class = @"DLS151129";
    NSLog(@"自我介绍");
    NSLog(@"我是%@性别%@今年%@课程是%@班级是%@", _Teacher_2_2Name, _Teacher_2_2Sex, _Teacher_2_2Age, _Teacher_2_2Course, _Teacher_2_2Class);

    }

@end



//
// Class_2_1.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface Class_2_1 : NSObject
{

NSString *_Class_2_1Training_institutions;
NSString *_Class_2_1Class_name;
NSString *_Class_2_1Number;
NSString *_Class_2_1Teacher_name;
NSString *_Class_2_1Date;

}

  • (void)a;
  • (void)b;
  • (void)c;

@end


//
// Class_2_1.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "Class_2_1.h"

@implementation Class_2_1

  • (void)a
    {

    _Class_2_1Class_name = @"DLS151129";
    _Class_2_1Training_institutions = @"蓝鸥";
    _Class_2_1Number = @"40";
    _Class_2_1Date = @"2015-11-09-09:00";
    _Class_2_1Teacher_name = @"marry";
    NSLog(@"学校:%@ 集体活动", _Class_2_1Training_institutions);
    NSLog(@"开班时间:%@", _Class_2_1Date);

    }

  • (void)b
    {

    NSLog(@"开班仪式");

    }

  • (void)c
    {

    NSLog(@"开班仪式正式开始");

    }

@end



//
// monitor unit_10.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface monitor_unit_10 : NSObject
{

NSString *_monitor_unit_10Name;
NSString *_monitor_unit_10Size;
NSString *_monitor_unit_10Colour;
NSString *_monitor_unit_10Model;
NSString *_monitor_unit_10Brand_Name;

}

  • (void)setandget10;
  • (void)eat10;
  • (void)drink10;

@end


//
// monitor unit_10.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "monitor unit_10.h"

@implementation monitor_unit_10

  • (void)setandget10
    {

    _monitor_unit_10Name = @"监控器";
    _monitor_unit_10Size = @"2.0";
    _monitor_unit_10Colour = @"白色";
    _monitor_unit_10Model = @"x2";
    _monitor_unit_10Brand_Name = @"MM";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 品牌:%@", _monitor_unit_10Name, _monitor_unit_10Size, _monitor_unit_10Colour, _monitor_unit_10Model, _monitor_unit_10Brand_Name);

    }

  • (void)eat10
    {

    NSLog(@"32");

    }

  • (void)drink10
    {

    NSLog(@"31");

    }

@end



//
// USB_9.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface USB_9 : NSObject
{

NSString *_USB_9Name;
NSString *_USB_9Size;
NSString *_USB_9Colour;
NSString *_USB_9Model;
NSString *_USB_9Brand_Name;

}

  • (void)setandget9;
  • (void)eat9;
  • (void)drink9;

@end


//
// USB_9.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "USB_9.h"

@implementation USB_9

  • (void)setandget9
    {

    _USB_9Name = @"USB";
    _USB_9Size = @"2G";
    _USB_9Colour = @"红色";
    _USB_9Model = @"x1";
    _USB_9Brand_Name = @"金士顿";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 品牌:%@", _USB_9Name, _USB_9Size, _USB_9Colour, _USB_9Model, _USB_9Brand_Name);

    }

  • (void)eat9
    {

    NSLog(@"12");

    }

  • (void)drink9
    {

    NSLog(@"32");

    }

@end



//
// LCD_8.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface LCD_8 : NSObject
{

NSString *_LCD_8Name;
NSString *_LCD_8Size;
NSString *_LCD_8Colour;
NSString *_LCD_8Model;
NSString *_LCD_8Brand_Name;

}

  • (void)setandget8;
  • (void)eat8;
  • (void)drink;

@end


//
// LCD_8.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "LCD_8.h"

@implementation LCD_8

  • (void)setandget8
    {

    _LCD_8Name = @"显示器";
    _LCD_8Size = @"14";
    _LCD_8Colour = @"白色";
    _LCD_8Model = @"2d";
    _LCD_8Brand_Name = @"三星";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 品牌:%@", _LCD_8Name, _LCD_8Size, _LCD_8Colour, _LCD_8Model, _LCD_8Brand_Name);

    }

  • (void)eat8
    {

    NSLog(@"12");

    }

  • (void)drink
    {

    NSLog(@"as");

    }

@end



//
// mouse_7.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface mouse_7 : NSObject
{

NSString *_mouse_7Name;
NSString *_mouse_7Size;
NSString *_mouse_7colour;
NSString *_mouse_7model;
NSString *_mouse_7Brand_Name;

}

  • (void)setandget7;
  • (void)eat7;
  • (void) drink7;

@end


//
// mouse_7.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "mouse_7.h"

@implementation mouse_7

  • (void)setandget7
    {

    _mouse_7Name = @"鼠标";
    _mouse_7Size = @"1.0";
    _mouse_7colour = @"黑色";
    _mouse_7model = @"3z";
    _mouse_7Brand_Name = @"罗技";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 品牌:%@", _mouse_7Name, _mouse_7Size, _mouse_7colour, _mouse_7model, _mouse_7Brand_Name);

    }

  • (void)eat7
    {

    NSLog(@"12");

    }

  • (void)drink7
    {

    NSLog(@"32");

    }

@end



//
// computer keyboard_6.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface computer_keyboard_6 : NSObject
{

NSString *_computer_keyboard_6Name;
NSString *_computer_keyboard_6Size;
NSString *_computer_keyboard_6colour;
NSString *_computer_keyboard_6Model;
NSString *_computer_keyboard_6Brand_Name;

}

  • (void)setandget6;
  • (void)eat6;
  • (void)drink6;

@end


//
// computer keyboard_6.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "computer keyboard_6.h"

@implementation computer_keyboard_6

  • (void)setandget6
    {

    _computer_keyboard_6Name = @"键盘";
    _computer_keyboard_6Size = @"6*12";
    _computer_keyboard_6colour = @"黑色";
    _computer_keyboard_6Model = @"z2";
    _computer_keyboard_6Brand_Name = @"罗技";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 品牌:%@", _computer_keyboard_6Name, _computer_keyboard_6Size,_computer_keyboard_6colour, _computer_keyboard_6Model,_computer_keyboard_6Brand_Name);

    }

  • (void)eat6
    {

    NSLog(@"打字");

    }

  • (void)drink6
    {

    NSLog(@"打游戏");

    }

@end



//
// air conditioning_5.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface air_conditioning_5 : NSObject
{

NSString *_air_conditioning_5Name;
NSString *_air_conditioning_5Size;
NSString *_air_conditioning_5Colour;
NSString *_air_conditioning_5Model;
NSString *_air_conditioning_5Brand_Name;

}

  • (void)setandget_5;
  • (void)eat_5;
  • (void)drink_5;

@end


//
// air conditioning_5.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "air conditioning_5.h"

@implementation air_conditioning_5

  • (void)setandget_5
    {

    _air_conditioning_5Name = @"空调";
    _air_conditioning_5Size = @"5*10";
    _air_conditioning_5Colour = @"白色";
    _air_conditioning_5Model = @"z1";
    _air_conditioning_5Brand_Name = @"格力";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 品牌:%@", _air_conditioning_5Name, _air_conditioning_5Size, _air_conditioning_5Colour, _air_conditioning_5Model, _air_conditioning_5Brand_Name);

    }

  • (void)eat_5
    {

    NSLog(@"格力2");

    }

  • (void)drink_5
    {

    NSLog(@"美的");

    }

@end



//
// computer_4.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface computer_4 : NSObject
{

NSString *_computer_4Name;
NSString *_computer_4Size;
NSString *_computer_4Colour;
NSString *_computer_4Model;
NSString *_computer_4Brand_Name;

}

  • (void)setAndGet4;
  • (void)eat4;
  • (void)drink4;

@end


//
// computer_4.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "computer_4.h"

@implementation computer_4

  • (void)setAndGet4
    {

    _computer_4Name = @"Mac book";
    _computer_4Size = @"12";
    _computer_4Colour = @"银白色";
    _computer_4Model = @"1112";
    _computer_4Brand_Name = @"Apple";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 商标:%@", _computer_4Name, _computer_4Size, _computer_4Colour, _computer_4Model, _computer_4Brand_Name);

    }

  • (void)eat4
    {

    NSLog(@"联想");

    }

  • (void)drink4
    {

    NSLog(@"华为");

    }

@end



//
// Cup_3.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface Cup_3 : NSObject
{

NSString *_Cup_3Name;
NSString *_Cup_3Colour;
NSString *_Cup_3Brand_Name;
NSString *_Cup_3Size;
NSString *_Cup_3Model;

}

  • (void)setAndGet3;
  • (void)eat3;
  • (void)drink3;

@end


//
// Cup_3.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "Cup_3.h"

@implementation Cup_3

  • (void)setAndGet3
    {

    _Cup_3Name = @"杯子";
    _Cup_3Size = @"20L";
    _Cup_3Colour = @"红色";
    _Cup_3Model = @"c1";
    _Cup_3Brand_Name = @"乐扣";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 商标:%@", _Cup_3Name, _Cup_3Size, _Cup_3Colour, _Cup_3Model, _Cup_3Brand_Name);

    }

  • (void)eat3
    {

    NSLog(@"喝水");

    }

  • (void)drink3
    {

    NSLog(@"喝茶");

    }

@end



//
// Phone_2.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface Phone_2 : NSObject
{

NSString *_Phone_2Name;
NSString *_Phone_2Size;
NSString *_Phone_2Colour;
NSString *_Phone_2Model;
NSString *_Phone_2Brand_Name;

}

  • (void)steAndGet2;
  • (void)eat2;
  • (void)drink2;

@end


//
// Phone_2.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "Phone_2.h"

@implementation Phone_2

  • (void)steAndGet2
    {

    _Phone_2Name = @"小米";
    _Phone_2Size = @"4.5";
    _Phone_2Colour = @"红色";
    _Phone_2Model = @"m3";
    _Phone_2Brand_Name = @"MI";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 商标:%@", _Phone_2Name, _Phone_2Size, _Phone_2Colour,_Phone_2Model, _Phone_2Brand_Name);

    }

  • (void)eat2
    {

    NSLog(@"华为");

    }

  • (void)drink2
    {

    NSLog(@"iPhone");

    }

@end



//
// Car_1.h
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

@interface Car_1 : NSObject
{

NSString *_Car_1Name;
NSString *_Car_1Colour;
NSString *_Car_1Size;
NSString *_Car_1Brand_Name;
NSString *_Car_1Model;

}

  • (void)setAndGet1;
  • (void)eat1;
  • (void)drink1;

@end


//
// Car_1.m
// OC_NO.1
//
// Created by YIem on 15/11/24.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "Car_1.h"

@implementation Car_1

  • (void)setAndGet1
    {

    _Car_1Name = @"R8";
    _Car_1Size = @"2M";
    _Car_1Colour = @"红色";
    _Car_1Model = @"zs1";
    _Car_1Brand_Name = @"BB";
    NSLog(@"名字:%@ 大小:%@ 颜色:%@ 型号:%@ 商标:%@", _Car_1Name, _Car_1Size, _Car_1Colour, _Car_1Model, _Car_1Brand_Name);

    }

  • (void)eat1
    {

    NSLog(@"跑");

    }

  • (void)drink1
    {

    NSLog(@"飞");

    }

@end

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »