20165305 experiment Two: Java Object-oriented programming

Source: Internet
Author: User

0-s
Reference Http://www.cnblogs.com/rocedu/p/6371315.html#SECUNITTEST
Reference http://www.cnblogs.com/rocedu/p/6736847.html

Submit the last three test cases are passed, to have paint and watermark, enter their own school number.
Code Cloud Link:
Https://gitee.com/BESTI-IS-JAVA-2018/java-besti-is-djw20165328/tree/master/shiyan2

2-2
Refer to Active knock code, using JUnit to learn Java (http://www.cnblogs.com/rocedu/p/4837092.html)
Study StringBuffer in TDD, submit your unit test case and test pass, add the number watermark.

2-3
Experiment two Java object-oriented programming (http://www.cnblogs.com/rocedu/p/4472842.html)

Reference http://www.cnblogs.com/rocedu/p/6736847.html

Extend the design pattern example, experience the application of OCP principle and dip principle, understand the design pattern preliminarily
Use your own study number%6 to take the remainder operation, according to the result of code expansion:
0: Let the system support the Byte class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
1: Let the system support the short class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
2: Let the system support the Boolean class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
3: Let the system support the long class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
4: Let the system support the float class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
5: Let the system support the double class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
Code Cloud Link:
Https://gitee.com/BESTI-IS-JAVA-2018/java-besti-is-djw20165328/tree/master/shiyan2

2-4
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:

Define properties and generate Getter,setter
Double Realpart;
Double Imagepart;
Defining constructors
Public Complex ()
Public Complex (double r,double I)

Override Object
public boolean equals (Object obj)
Public String toString ()

Define public methods: subtraction
Complex Complexadd (Complex a)
Complex complexsub (Complex a)
Complex Complexmulti (Complex a)
Complex Complexdiv (Complex a)
Code Cloud Link:
Https://gitee.com/BESTI-IS-JAVA-2018/20165305zhenlong/blob/master/src/Complex.java
Https://gitee.com/BESTI-IS-JAVA-2018/20165305zhenlong/blob/master/src/ComplexTest.java

2-5
Use WHITESTARUML to model the code in experiment two, send class diagram, plus number watermark.
Reference http://www.cnblogs.com/rocedu/p/6736847.html

There are only two classes in a class diagram.

Experiment Summary:
Today, when writing the code, there was an error java.lang.noclassdeffounderror:org/hamcrest/selfdescribing.
Took a lot of detours, and later learned that more than 4.11 version no longer contains hamcrest.
So now there are two ways to solve it:
The 1.junit version drops to 4.11.
2. Import Hamcrest-core-1.3.jar
Later I remember, once I had a junit4.7 version, so I solved the problem.
For the results of this experiment, I am still more satisfied, but because of negligence, late handed a week, in this to the teacher said the sound of hard!

20165305 experiment Two: Java Object-oriented programming

Related Article

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.