2017.4.6课后作业(第四章.简答题4)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2017.4.6课后作业(第四章.简答题4)相关的知识,希望对你有一定的参考价值。
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace lesson4.entity 8 { 9 /// <summary> 10 /// 甜品类 11 /// </summary> 12 class TP 13 { 14 public TP(string name) 15 { 16 this.Name = name; 17 } 18 19 /// <summary> 20 /// 甜品名 21 /// </summary> 22 public string Name { get; set; } 23 } 24 }
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace lesson4.entity 8 { 9 /// <summary> 10 /// 蚂蚁类 11 /// </summary> 12 class MY 13 { 14 public MY(string name) 15 { 16 this.Name = name; 17 } 18 /// <summary> 19 /// 蚂蚁名字 20 /// </summary> 21 public string Name{get;set;} 22 23 24 /// <summary> 25 /// 问好 26 /// </summary> 27 public void SayHi() 28 { 29 Console.WriteLine("大家好!我是一只小蚂蚁,名叫"+Name); 30 } 31 32 /// <summary> 33 /// 找甜品 34 /// </summary> 35 public void Find(TP tp) 36 { 37 Console.WriteLine("我找到一块甜品:{0}",tp.Name); 38 } 39 40 /// <summary> 41 /// 招呼伙伴 42 /// </summary> 43 public void Partner(int count) 44 { 45 Console.WriteLine("我招呼到{0}个同伴",count); 46 } 47 48 /// <summary> 49 /// 工作 50 /// </summary> 51 public void Work() 52 { 53 Console.WriteLine("现在,大家搬运甜品"); 54 Console.WriteLine("我们完成寻找甜品的任务!"); 55 } 56 } 57 }
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using lesson4.entity; 7 8 namespace lesson4 9 { 10 class Program 11 { 12 static void Main(string[] args) 13 { 14 MY my = new MY("小不点"); 15 my.SayHi(); 16 TP tp = new TP("提拉米苏"); 17 my.Find(tp); 18 my.Partner(2); 19 my.Work(); 20 Console.Read(); 21 } 22 } 23 }
以上是关于2017.4.6课后作业(第四章.简答题4)的主要内容,如果未能解决你的问题,请参考以下文章