7.10.3 PHP图形计算器主程序的实现

7.10.3 PHP图形计算器主程序的实现

index.php


    
        简单的图形计算器
        
    

    
        

简单的图形计算器

矩形 || 三角形


"; } ?>

rect.class.php

width = $arr['width'];
        $this->height = $arr['height'];
        $this->name = $arr['name'];
    }
    
    function area() {
        return $this->width * $this->height;
    }

    function zhou() {
        return 2*($this->width + $this->height);
    }

    function view() {
        $form = '
'; $form .= $this->name.'的宽:
'; $form .= $this->name.'的高:
'; $form .= '
'; $form .=''; } function yan($arr) { $bg = true; if($arr['width'] < 0) { echo $this->name."的宽不能为0!
"; $bg = false; } if($arr['height'] < 0) { echo $this->name."的高度不能小于0!
"; $bg = false; } return $bg; } }

shape.class.php

你可能感兴趣的:(7.10.3 PHP图形计算器主程序的实现)