Sixth job --static keyword, subject

## a title

##Computer

Package Penalty for Train.Method.TeachDemo.Thread.Fuction; 

/ ** 
 * factorial algorithm for the n 
 * @author meow 
 * @date 2019 Nian 9 18 afternoon 1:19:34 
 * / 
public  class Computer {
     public  int NUM; 

    public Computer () { 
    } 

    public Computer ( int NUM) {
         the this .num = NUM; 
    } 

    public  Long counter () {
         Long SUM =. 1 ;
         for ( int I =. 1; I <= NUM; I ++ ) { 
            SUM = SUM * I ;
        }
        return sum;
    }
}

##Test

package Train.Method.TeachDemo.Thread.FuctionTest;
import Train.Method.TeachDemo.Thread.Fuction.Computer;

import java.util.Scanner;

import Train.Method.TeachDemo.Thread.Fuction.Computer;
/**
 * Test
 * @author 喵
 * @date 2019年9月18日下午8:08:53
 */
public class ComputerTest {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = input.nextInt();
        
        Computer t = new Computer(num);
        System.out.println(t.counter());
    }
} 

## title two

##MyPoint

/ ** 
 * coordinate class 
 * 
 * @author Meow 
 * @date 2019 years. 9 18 afternoon 8:12:32 
 * / 
public  class MyPoint {
     Private  int X;
     Private  int Y; 

    public MyPoint () { 

    } 

    public MyPoint ( int X, int Y) {
         the this .x = X;
         the this .y = Y; 
    } 

    public  int getX () {
         return X; 
    } 

    public  void setX ( int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public static double distance(MyPoint p1, MyPoint p2) {
        int xside = Math.abs(p1.x - p2.x);
        int yside = Math.abs(p1.y - p2.y);
        double temp = Math.pow(xside, 2) + Math.pow(yside, 2);
        return (Math.sqrt(temp));
    }
}

##Test

Import java.util.Scanner; 

/ ** 
 * Class test point distance 
 * @author meow 
 * @date 2019 Nian 9 18 afternoon 3:53:51 
 * / 
public  class the Test {
     public  static  void main (String [] args) { 
        Scanner iNPUT = new new Scanner (the System.in); 
        System.out.println ( "Please enter the coordinates of the points p1" );
         int X1 = input.nextInt ();
         int Y1 = input.nextInt (); 
        the System.out. the println ( "Please enter the coordinates of the point p2" );
         int X2 = input.nextInt ();
         int= Y2 input.nextInt (); 
        
        MyPoint P1 = new new MyPoint (X1, Y1); 
        MyPoint P2 = new new MyPoint (X2, Y2); 
        System.out.println ( "distance between the two points;" + MyPoint.distance (P1, P2)); 
    } 
}

Guess you like

Origin www.cnblogs.com/CatMiao1176/p/11545110.html