rectangle

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
import java.util.Scanner;
public class Example2_6 {
    public static void main(String agrs[]){
        Rect rectangle=new Rect();
        Scanner reader =new Scanner (System.in);
        System.out.println("input rectangle's width and affirm");
        rectangle.width = reader.nextDouble();
        
        System.out.println("input rectangle's heitght and affirm");
        rectangle.height= reader.nextDouble();
        
        double area=rectangle.getArea();
        System.out.println("the area of rectangle is :"+area);
        
    }
    
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
public class Rect {
    double width;
    double height;
    double getArea()
    {
        double area=width*height;
        return area;
    }
}

你可能感兴趣的:(rectangle)