Zhang Ping 13-1 201303014010 practice three-knot pair project

Source: Internet
Author: User

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

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.