20165105 Experiment 2 Object-Oriented Programming

20165105 Experiment 2 Object-Oriented Programming

Submission point 1, JUnit test case

Requirements: Submit the screenshots of the last three test cases that have passed. The screenshots must be painted and watermarked, and enter your student ID.

 

Submission point 2, TDD method xuexiStringBuffer

Requirements: Study and learn StringBuffer in a TDD way, submit your unit test cases and screenshots of passing tests, and add the student number watermark to the screenshots.

Experimental process: Only the constructor, charAt method, capacity method, indexo method, toString method and length method are tested, and other methods can be found in the API documentation in detail.

 

 

 

Submission point 3: Application of OCP principles and DIP principles

Require:

1. Expand the design pattern examples, realize the application of OCP principles and DIP principles, and have a preliminary understanding of design patterns

2. Let the system support the byte class, and add the test code to the MyDoc class to indicate that the addition is correct, submit the test code and the screenshot of the running result, and add the student number watermark

 

 

Commitment point 4: Develop a complex class Complex

Requirement: Develop a complex number class Complex in a TDD manner

  • Define properties and generate getters, setters, double RealPart; double ImagePart;
  • public Complex(), public Complex(double R,double I)
  • Override Object:public boolean equals(Object obj) 和 public String toString()
  • Defining public methods: addition, subtraction, multiplication and division
    • Complex ComplexAdd(Complex a)
    • Complex ComplexSub(Complex a)
    • Complex ComplexMulti(Complex a)
    • Complex ComplexDiv(Complex a)

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324491401&siteId=291194637