文件名称:listener
- 所属分类:
- JSP源码/Java
- 资源属性:
- 上传时间:
- 2013-04-27
- 文件大小:
- 37kb
- 下载次数:
- 0次
- 提 供 者:
- am***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
设计接口Method,该接口仅有一个方法:
double calArea( ),用于计算面积。
(2)设计矩形类Rectangle,并实现接口Method,要求如下:
成员变量length:int型,代表矩形的长度;
成员变量width:int型,代表矩形的宽度;
构造函数Rectangle(int l, int w):将length和width初始化为参数给定的值;
接口方法calArea( )的实现:根据长length和宽width计算矩形的面积。
(3)设计正方形类Square,继承矩形类Rectangle ,要求如下:
成员变量edge:int型,代表正方形的边长;
构造函数Square(int e):将边长edge初始化参数给定的值;
覆盖父类的方法calArea( ):计算正方形的面积;
成员方法int calPerimeter( ):根据边长edge计算正方形的周长。
(4)编写测试类Test,计算并输出边长为3的正方形的面积和边长
-Design interface method, the interface is just a method: double calArea, (), used to calculate the area. (2) the design of the rectangle class Rectangle, and interface Method requirements are as follows: member variable length: int, on behalf of the length of the rectangle member variable width: int, width of the rectangle constructor Rectangle (int l, int w) : the length and width initialize the value given for the parameter implementation of the interface the method calArea (): according to the long length and wide width to calculate the area of a rectangle. (3) Design square Square, inheritance rectangle class Rectangle requirements are as follows: member variable edge: int, on behalf of the side of a square constructor Square (int e): the side length of the edge initialization parameters given value override the parent the class methods calArea (): calculate the area of a square member method int calPerimeter (): calculated based on the long side e
double calArea( ),用于计算面积。
(2)设计矩形类Rectangle,并实现接口Method,要求如下:
成员变量length:int型,代表矩形的长度;
成员变量width:int型,代表矩形的宽度;
构造函数Rectangle(int l, int w):将length和width初始化为参数给定的值;
接口方法calArea( )的实现:根据长length和宽width计算矩形的面积。
(3)设计正方形类Square,继承矩形类Rectangle ,要求如下:
成员变量edge:int型,代表正方形的边长;
构造函数Square(int e):将边长edge初始化参数给定的值;
覆盖父类的方法calArea( ):计算正方形的面积;
成员方法int calPerimeter( ):根据边长edge计算正方形的周长。
(4)编写测试类Test,计算并输出边长为3的正方形的面积和边长
-Design interface method, the interface is just a method: double calArea, (), used to calculate the area. (2) the design of the rectangle class Rectangle, and interface Method requirements are as follows: member variable length: int, on behalf of the length of the rectangle member variable width: int, width of the rectangle constructor Rectangle (int l, int w) : the length and width initialize the value given for the parameter implementation of the interface the method calArea (): according to the long length and wide width to calculate the area of a rectangle. (3) Design square Square, inheritance rectangle class Rectangle requirements are as follows: member variable edge: int, on behalf of the side of a square constructor Square (int e): the side length of the edge initialization parameters given value override the parent the class methods calArea (): calculate the area of a square member method int calPerimeter (): calculated based on the long side e
(系统自动生成,下载前可以参看下载内容)
下载文件列表
[5]SummaryInformation
0Table
Data
WordDocument
[5]DocumentSummaryInformation