void Start() { //7. 请将第4题转化为c#代码。 //======================================================实例化================================================================== Food sd = new Sardine(); Wing greywing = new Wing(); Seagull sg = new Seagull("seagull", 20, greywing, sd); Food shrimp = new Shrimp(); Wing brownwing = new Wing(); Petrel pt = new Petrel("petrel", 20, brownwing, shrimp); Food apple = new Apple(); Wing hazelwing = new Wing(); Ostrich os = new Ostrich("ostrich", 20, hazelwing, apple); //8. 请将第5题转化为c#代码。 //======================================================实例化================================================================== Human Ningning = new Human("Ningning"); Human Wuwu = new Human("wuwu"); Human Zz = new Human("zz"); FruitShop fruitShop = new FruitShop(); ClothingShop clothingShop = new ClothingShop(); Ningning.Shopping(fruitShop.Selling()); Ningning.Giving(Ningning.goods, Wuwu); Wuwu.Eat(Wuwu.goods); Ningning.Shopping(clothingShop.Selling()); Ningning.Giving(Ningning.goods, Zz); Zz.Wear(); //9. 请将第6题转化为c#代码。 //======================================================实例化================================================================== Director Baibai = new Director("baibai"); List<Developer> friends = new List<Developer> { new Developer("writer"), new Developer("charactordesigner"), new Developer("setdesigner"), new Developer("animator"), new Developer("composer"), new Developer("sounddesigner"), }; Audience dalao = new Audience(); Baibai.CallingFriends(friends); Baibai.ShowToAudience(dalao); dalao.CommentFilm(Baibai.DirectFilm()); }
public static void Main() { FruitShop fruitShop = new FruitShop(); Fruit fruitApple = new Fruit("Apple", "10"); Fruit fruitPear = new Fruit("Pear", "12"); Fruit fruitGrape = new Fruit("Grape", "15"); fruitShop.Add(fruitApple); fruitShop.Add(fruitPear); fruitShop.Add(fruitGrape); foreach (Fruit f in fruitShop) { Debug.Log(f.fruitName + ": " + f.fruitPrice); } }
void Start() { People ningning = new People("Ningning", "买"); People zz = new People("zz", "戴在头上"); People wuwu = new People("wuwu", "吃掉了"); People friendszz = new People("zz", null); People friendswuwu = new People("wuwu", null); ClothingShop clothingShop = new ClothingShop("服装店", "帽子"); FruitShop fruitShop = new FruitShop("水果店", "西瓜"); Story(ningning, clothingShop, friendszz); Story(ningning, fruitShop, friendswuwu); Story(zz, clothingShop, null); Story(wuwu, fruitShop, null); }
void RunQ5() { Person ninging = new Person("Ningning"); Person wuwu = new Person("Wuwu"); Person zz = new Person("ZZ"); WaterMelon waterMelon = new WaterMelon("sweetWaterMelon", 5.0f); FruitShop fruitShop = new FruitShop(waterMelon, 2); Hat niceHat = new Hat("niceHat", 120.0f); ClothingShop clothingShop = new ClothingShop(niceHat, 1); ninging.BuyItem(fruitShop, 10.0f, waterMelon); ninging.BuyItem(clothingShop, 200.0f, niceHat); ninging.Gifting(ninging.ownedItems[0], wuwu); ninging.Gifting(ninging.ownedItems[0], zz); wuwu.EatFood((BBBB.Food)wuwu.ownedItems[0]); zz.PutOn((BBBB.Clothing)zz.ownedItems[0]); }