文件名称:TestShape
介绍说明--下载内容均来自于网络,请自行研究使用
写一个父类图形(Shape)(无属性,方法:计算周长,计算面积),
两个子类:矩形(Rect 属性:长,宽;方法:计算周长,计算面积),
圆形(Circle 属性:半径 方法:计算周长,计算面积)
并写一个测试类TestShape,含main方法,创建各个类的对象,用参数化构造方法为属性赋值,输出各个图形的周长和面积。-Write a parent class graphics (Shape) (no properties, methods: calculating perimeter, area calculation), two sub-categories: rectangular (Rect attributes: length, width method: calculation of perimeter, area calculation), round (Circle Properties : radius method: calculation of perimeter, area calculation) and write a test class TestShape, including the main method to create each type of object, parameterized constructor for the attribute assignment, the output of each graphic in the perimeter and area.
两个子类:矩形(Rect 属性:长,宽;方法:计算周长,计算面积),
圆形(Circle 属性:半径 方法:计算周长,计算面积)
并写一个测试类TestShape,含main方法,创建各个类的对象,用参数化构造方法为属性赋值,输出各个图形的周长和面积。-Write a parent class graphics (Shape) (no properties, methods: calculating perimeter, area calculation), two sub-categories: rectangular (Rect attributes: length, width method: calculation of perimeter, area calculation), round (Circle Properties : radius method: calculation of perimeter, area calculation) and write a test class TestShape, including the main method to create each type of object, parameterized constructor for the attribute assignment, the output of each graphic in the perimeter and area.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
TestShape.java