20165304 experiment two Java object-oriented programming

Source: Internet
Author: User

I. Object-oriented programming for unit testing and TDD

Experimental requirements

1. Refer to Http://www.cnblogs.com/rocedu/p/6371315.html#SECUNITTEST to complete unit test learning
2. Submit the last three JUnit test cases (normal, error, boundary condition) through, to have paint and watermark, enter their own school number
3. This submission point examines whether JUnit will be used, and the test case must contain at least the normal, error, and boundary conditions of the test

Second, object-oriented programming 2--using TDD learning to study StringBuffer

Experimental requirements

参考 积极主动敲代码,使用JUnit学习Java (http://www.cnblogs.com/rocedu/p/4837092.html)以 TDD的方式研究学习StringBuffer提交你的单元测试用例和测试通过的,要加上学号水印测试自己会不会写JUnit测试用例代码

Third, object-oriented programming-3

Experimental requirements

参考http://www.cnblogs.com/rocedu/p/6736847.html对设计模式示例进行扩充,体会OCP原则和DIP原则的应用,初步理解设计模式用自己的学号%6进行取余运算,根据结果进行代码扩充0: 让系统支持Byte类,并在MyDoc类中添加测试代码表明添加正确,提交测试代码和运行结的,加上学号水印1: 让系统支持Short类,并在MyDoc类中添加测试代码表明添加正确,提交测试代码和运行结的,加上学号水印2: 让系统支持Boolean类,并在MyDoc类中添加测试代码表明添加正确,提交测试代码和运行结的,加上学号水印3: 让系统支持Long类,并在MyDoc类中添加测试代码表明添加正确,提交测试代码和运行结的,加上学号水印4: 让系统支持Float类,并在MyDoc类中添加测试代码表明添加正确,提交测试代码和运行结的,加上学号水印5: 让系统支持Double类,并在MyDoc类中添加测试代码表明添加正确,提交测试代码和运行结的,加上学号水印代码

Four, object-oriented programming-4

Experimental requirements

Submit: Unit test code and run success and code on the cloud Codes link, to add the number watermark
Reference http://www.cnblogs.com/rocedu/p/6736847.html
Task: Developing a plural class complex in TDD, with the following requirements:

// 定义属性并生成getter,setterdouble RealPart;double ImagePart;// 定义构造函数public Complex()public Complex(double R,double I)//Override Objectpublic boolean equals(Object obj)public String toString()// 定义公有方法:加减乘除Complex ComplexAdd(Complex a)Complex ComplexSub(Complex a)Complex ComplexMulti(Complex a)Complex ComplexDiv(Complex a)```

Code

Five UML classes

Experimental requirements

使用StarUML对实验二中的代码进行建模,发类图的,加上学号水印类图中只少两个类类,继承,接口实现,组合在UML中表达

20165304 experiment two Java object-oriented programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.