- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
关键代码如下: class UserException : Exception //定义用户的异常类 { //重载Exception类的构造函数 public UserException() { } public UserException(string ms):base(ms) { } public UserException(string ms,Exception inner) : base(ms,inner) { } } class student //定义学生类 { private string name; //姓名,长度不超过8个字节 private double score; //成绩,范围为[0,100] public void setInfo(string name, double score) { if (name.Length 8) { throw (new UserException(姓名长度超过了8个字节!)); } if (score 0 || score 100) { throw (new UserException(非法的分数!)); } this.name = name; this.score = score; } } static void Main(string[] args) { student s = new student(); try { s.setInfo(张三, 958.5); } catch (Exception e) { Console.WriteLine(产生异常:{0}, e.Message); } Console.ReadKey(); } 执行该程序 : 在运行过程中由于试图对score赋值958.5,结果导致下列异常被创建和抛出: new UserException(非法的分数!) SAY THIS: Example: “PREPARING TO BUILD A HOUSE.” Looking at the various models leading up to the construction of a house, one usually begins with a sketch of the proposed dwelling. This may be followed by a miniature scale model of the house. Finally, the blueprints are rendered which provide the technical specifications and the mechanical requirements for the builders. Each model gets reviewed and approved before the next stage begins, offering several opportunities to consider design improvements before groundbreaking. Using ERwin, our model creates the Database Schema for the database which will house our data. SAY THIS: Example: “PREPARING TO BUILD A HOUSE.” Looking at the various models leading up to the construction of a house, one usually begins with a sketch of the proposed dwelling. This may be followed by a m
您可能关注的文档
最近下载
- 个人简历表格下载word(最新).pdf VIP
- 信捷DS3-DS3E-DS3L系列伺服驱动器用户使用手册.pdf
- 老年康复习题.pdf VIP
- 2024全民反诈知识竞赛题库及答案(1-200道).docx VIP
- 高中二年级上学期数学《点到直线的距离公式》教学课件.pptx VIP
- 物业保安部管理服务手册.doc VIP
- 静电场中的能量单元测试-2024-2025学年高二上学期物理人教版(2019)必修第三册.docx VIP
- 【中国吸烟危害健康报告2020】.pdf VIP
- 浙江省宁波市南三县2024-2025学年八年级上学期期末考试数学试卷(含答案).docx VIP
- 2024-2030年中国氧化聚乙烯蜡(OPE蜡)行业市场发展趋势与前景展望战略分析报告.docx
文档评论(0)