如何用C#来解决这个问题 [英] How to approach this with C#

查看:81
本文介绍了如何用C#来解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两种动物:zoro和toro。这些动物是致命的敌人,每当他们相遇时都会经常与死亡战斗。 zoros以其尖锐刺耳的牙齿而臭名昭着,并且众所周知,它们从前方捕食toro以获得战斗优势。托托以其致命的尖刺尾巴而闻名,并且往往更喜欢从后方攻击zoro以获得优势。写一个模拟2个生物(1个zoro和1个toro)的程序,并显示他们的战斗结果。一定要在代码中展示面向对象编程的4个原则。



我尝试过:



There are 2 animal species: zoro and toro. These animals are mortal enemies and often battle to the death whenever they meet. zoros are notorious for their sharp, piercing teeth, and are known to prey on toro from the front to gain an advantage in battle. toto are well known for their deadly spiked tails, and will often prefer to attack zoro’s from the rear to gain an advantage. Write a program that models 2 creatures (1 zoro and 1 toro) and shows results of their fight. Be sure to showcase the 4 principles of object oriented programming in your code.

What I have tried:

public class zoro
{
    public teeth {get;set;}
}
public class teeth
{
     public string sharp {get;set;}
     public string piercing {get;set;}
}

推荐答案

我们不做你的家庭作业。

HomeWork未设置测试你的滑雪在乞求其他人做你的工作时,它会让你思考并帮助你的老师检查你对所学课程的理解,以及你应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

所以,试一试,重读你的课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并进行必要的调整以适应你的实际问题。
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.


只是为了给你一个良好的开端,

1. zoro和toro有什么共同的?从家庭作业陈述中读出来,似乎他们都有自己喜欢的猎物,可以用某种致命武器以某种方式进行战斗了吗?您是否可以创建一个通用蓝图来表示拥有此类功能(属性)和行为(方法)的任何生物,而无需具体细节。那将是OOP中的

2.为zoro创建一个特定的类,它继承自生物蓝图,但具有与zoro类相关的特定特征和行为。 />
3.为toro做同样的事情。

4.你必须自己完成剩下的旅程。请阅读面向对象编程概念(OOP)简介及更多内容 [ ^ ]

更加努力,不要害怕做出错误的转弯,你就会成功!
Just to give you a head start,
1. What do zoro and toro have in common? Reading from the homework statement, it seems that they both have their preferred preys, can fight in a certain way with their deadly weapon of sort, anymore? Can you create a generic blueprint that represents any creature that possesses such features (properties) and behaviors (methods) without specific details. That shall be the class in OOP.
2. Create a specific class for zoro that inherits from the creature blueprint but with specific features and behaviors pertaining to zoro kind.
3. Do the same for toro.
4. You will have to run the remaining journey yourself. Read out on Introduction to Object Oriented Programming Concepts (OOP) and More[^]
Try harder, not to be afraid to make some wrong turns, and you shall succeed!


这篇关于如何用C#来解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆