Java Third Experiment

Source: Internet
Author: User

The third experiment

Beijing Institute of Electronic Technology (BESTI)

Real Inspection report

Course: Java Programming Class: 1352 Name: Kun Huang No.: 20135226

Score: Instructor: Lou Jia Peng Experimental Date:

Experiment level: Preview degree: Experiment time:

Instrument Group: Compulsory/Elective: Elective experiment number: 3

Experiment Name: Agile Development and XP practice

Experimental purposes and requirements:

Complete the experiment, write the experiment Report, the experiment report is published in the blog Garden, note that the experimental report is focused on the running results, the problems encountered (tool search, installation, use, program editing, debugging, running, etc.), solutions (empty methods such as "Check Network", "Ask classmates", "reading" 0 points) as well as analysis (what can be learned from it, what gains, lessons, etc.). The report can refer to the guidance of Fan Fei Dragon Teacher

Experimental instrument:

Name

Model

Number

Pc

1

Refactoring:

One's complete refactoring process includes:

    1. Check out code from the version control system library
    2. Read code (including test code)
    3. Find Bad smell
    4. Refactoring
    5. Run all the unit Tests
    6. Check in code to codebase

Second, reconstruction skills

Iii. when to refactor

TDD test:

Iv. Games: Minesweeper

Import static org.junit.assert.*;

Import Org.junit.Test;
Import Java.awt.Color;
Import Java.awt.Graphics;
Import Java.awt.Rectangle;

Import myframe.constant;
public class Testtank {
private int x, y;
private int wid=constant.ww;
private int hei=constant.wh;
public int tet (int x, int y) {
this.x = x;
This.y = y;
return 0;
}
public void Draw (Graphics g) {
Color C=g.getcolor ();
G.setcolor (Color.gray);
G.fillrect (x, y, wid, HEI);
G.setcolor (c);
}
Public Rectangle GetRect () {
return new Rectangle (X,y,wid,hei);
}

@Test
public void Test () {

Assertequals (0,tet ());
}

}

Package Com.sf.minesweeper.bean;

Import Javax.swing.JLabel;
/**
* Custom Label (REI)
*/
public class Minelabel extends JLabel {

Private static final long serialversionuid = -7271927020145498558l;

/**
* Judging if it's thunder.
*
* */
Private Boolean ismine;
/**
* Determine if the Thunder block is expanded
*
* */
Private Boolean isexpanded;
/**
* Determine if the block is a flag
*
* */
Private Boolean Isflag;
/**
* Judging whether it is thunder and not marking the flag
* */
Private Boolean Ismineandnotflag;
/**
* Count counts the number of mines around the block
*
* */
private int minecount;
/**
* The line where the Rei is located
*
* */
private int rowIndex;
/**
* Column where Rei is located
*
* */
private int colindex;


private int expend=0;

The coordinates of the ranks on the mined area
Public Minelabel (int rowIndex, int colindex) {
This.rowindex = RowIndex;
This.colindex = Colindex;
}
has always been corresponding to some of the get and set methods
public Boolean ismine () {
return ismine;
}

public void Setmine (Boolean ismine) {
This.ismine = Ismine;
}

public Boolean isexpanded () {
return isexpanded;
}

public void setexpanded (Boolean isexpanded) {
this.isexpanded = isexpanded;
}

public Boolean Isflag () {
return isflag;
}

public void Setflag (Boolean isflag) {
This.isflag = Isflag;
}

public int Getminecount () {
return minecount;
}

public void Setminecount (int minecount) {
This.minecount = Minecount;
}

public int Getrowindex () {
return rowIndex;
}

public void Setrowindex (int rowIndex) {
This.rowindex = RowIndex;
}

public int Getcolindex () {
return colindex;
}

public void Setcolindex (int colindex) {
This.colindex = Colindex;


}
/**
* Rightclickcount Right click Count
*
* */
private int rightclickcount;

public int Getrightclickcount () {
return rightclickcount;
}

public void Setrightclickcount (int rightclickcount) {
This.rightclickcount = Rightclickcount;
}

}

Package Com.sf.minesweeper.bean;

public class Own implements comparable<own>{
private int times;
private String name;
Private String level;


public Own (int times, string name, string level) {
Super ();
This.times = times;
THIS.name = name;
This.level = level;
}
Public String Getlevel () {
return level;
}
public void SetLevel (String level) {
This.level = level;
}
public int gettimes () {
return times;
}
public void settimes (int times) {
This.times = times;
}
Public String GetName () {
return name;
}
public void SetName (String name) {
THIS.name = name;
}

public int CompareTo (Own arg0) {
TODO auto-generated Method Stub
int i = This.times-arg0.times;
if (i==0) {
Return This.name.hashCode ()-Arg0.name.hashCode ();
}
return i;
}

}

The interface is as follows:

Problems and Solutions:

No

Java Third Experiment

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.