20165220 Experiment 3 Agile Development and XP Practice Experiment Report

Experiment 3 Agile Development and XP Practice-1

Experimental requirements:

Experiment 3 Agile Development and XP Practice http://www.cnblogs.com/rocedu/p/4795776.html , the content of Eclipse is replaced with IDEA

Refer to http://www.cnblogs.com/rocedu/p/6371315.html#SECCODESTANDARD to install the alibaba plugin to solve the specification problem in the code.

Use the tool (Code->Reformate Code) in IDEA to reformat the following code, and then study the Code menu to find a function that makes you feel the best. Submit a screenshot and add your student ID watermark.

public class CodeStandard {
public static void main(String [] args){
StringBuffer buffer = new StringBuffer();
buffer.append('S');
buffer.append("tringBuffer");
System.out.println(buffer.charAt(1));
System.out.println(buffer.capacity());
System.out.println(buffer.indexOf("tring"));
System.out.println("buffer = " + buffer.toString());
if(buffer.capacity()<20)
buffer.append("1234567");
for(int i=0; i<buffer.length();i++)
System.out.println(buffer.charAt(i));
}
} 


Use the tool (Code->Reformate Code) to reformat the following code:


Find a function that you feel most useful: The functions in the code menu in IDEA are basically about the code itself, formatting, The code wraps up and down, etc. Among them, there is an option of optimize imports. Its main function is to delete useless and wrong imports. I think it is very useful. Experiment 3 Agile Development and XP Practice-2 Experiment Requirements:




Add your learning partner to your own project on the code cloud. After confirming that the partner's project is added to yourself, download the Complex code of partner experiment 2, add no less than three JUnit unit test cases, and git add .; git after the test is successful commit -m "Add content to your student number"; git push;

Submit a screenshot of the partner project git log, including the above git commit information, and add your own student number watermark information. 

Enter partner's Complex code

Add three JUnit unit test cases

upload code cloud

Experiment 3 Agile Development and XP Practice-3

Experimental requirements:

Experiment 3 Agile Development and XP Practice http://www.cnblogs.com/rocedu/p/4795776.html , the content of Eclipse is replaced with IDEA

Complete the refactoring exercises, download your partner's code, perform at least three refactorings, submit a screenshot of the refactored code, and add your own student ID watermark. Submit your partner's code cloud project link. 
Refactoring previous partner code

Code after refactoring
import java.util.Scanner;
public class Prime {
    public static void main(String[] args) {
        System.out.println("Please enter a positive integer: ");
        Scanner scanner=new Scanner(System.in);
        int N;
        N=scanner.nextInt();
        System.out.printf("The prime numbers of 1-%d are: ",N);
        for(int j=2;j<=N;j++) {
            if (zhishu(j)) {
                System.out.printf("%d,", j);
            }
        }
        System.out.println("\n");
    }

    public static boolean zhishu(int j) {
        if (j == 1) {
            return false;
        }
        else if(j==2){
            return true;
        }
        else{
            for (int i = 2; i < j; i++) {
                if (j % i == 0) {
                    return false;
                }
            }
        }
        return true;
    }
}

  run as follows

Upload code cloud:

Experiment 3 Agile Development and XP Practice-4

Experimental requirements:

Refer to http://www.cnblogs.com/rocedu/p/6683948.html to complete the learning of Java cryptography related content in pairs, combined with refactoring, git, and code standards.

Submit the learning outcome code cloud link and representative results screenshots, with a student ID watermark.

 

 

Guess you like

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