Practice Three Pair Project
School Number: 201303014010 name: Zhang Ping Ping class: ITCSC (Higher vocational) 13-1
I. Introduction of the topic:
Design a class named MyPoint that represents a point with an x-coordinate and a y-coordinate. This class includes:
- Two data fields X and Y with the Get method, representing their coordinates, respectively.
- An parameterless construction method that creates a point (0,0).
- A construction method that creates a specific coordinate point.
- Two data fields X and y each get method.
- A method named distance that returns the distance between two points of type MyPoint.
- A method named distance that returns the distance between two points that specify the x and y coordinates.
Two. Pair division
Pair: Zhang Ping Ping, Chengzhi
Zhang Ping: Program analysis and program testing and writing of test code
Chengzhi: Code writing and Code specification
Three. Code Address:
Https://github.com/elinesping/project3/tree/master
Four. Test the code:
Import static org.junit.assert.*;
Import Org.junit.Before;
Import Org.junit.Test;
public class Mypointtest {
@Before
public void SetUp () throws Exception {
}
@Test
public void Testdistance () {
MyPoint example=new mypoint ();
MyPoint a=new mypoint ();
MyPoint b=new mypoint ();
A.setx (5);
A.sety (8);
B.setx (1);
B.sety (8);
Double excepted=2;
Double Actuals=example.distance (A, b);
}
}
Five. Test situation:
The test method passed successfully, the following is the test success
Six. Questions and Experiences:
In this practice, I learned how to work with team members, teamwork is highly efficient, And I learned how to write test code to test the program. I found a lot of errors when I used JUNIT4 to check the program, but after I set up the test file, I also need to add the test code, and I also understand that to ensure the accuracy of the program, there are a few more tests.
Through this test I learned junit4, and better review of the previous Java knowledge also more understanding of Java polymorphism, and learned how to use the module test cases, but also learned how to use the blog and GitHub to better learn the current knowledge. Through this practice I found that in fact, my Java is not too skilled, need to be strengthened.
Zhang Ping 13-1 201303014010 practice three-knot pair project