运用PHP面向对象的知识设计一个图形计算器,同时也运用到了抽象类知识,这个计算器可以计算三角形的周长和面积以及矩形的周长和面积。本图形计算器有4个页面:1.PHP图形计算器主页index.php; 2.形状的抽象类shape.class.php; 3三角形计算类triangle.class.php; 4.矩形计算类rect.class.php。
PHP图形计算器代码点击下载: php图形计算器.zip
代码分别如下:
PHP图形计算器主页:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
形状的抽象类:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
三角形计算类文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
矩形计算类文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
>> 本文固定链接: http://php.ncong.com/yuanma/tuxing_jisuanqi.html
>> 转载请注明: 恩聪php 2014年09月01日 于 恩聪PHP学习教程 发表