文件名称:ShapeExp2
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:1.28kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
个人原创代码:矩形、圆形、五角星等形状的操作。编写Java Application程序,创建一个接口Shape,其中有抽象方法area,类Circle 、Rectangle实现area方法计算其面积并返回。又有Star实现Shape的area方法,其返回值是0,Star类另有一返回值boolean型方法isStar;在main方法里创建一个Vector,根据随机数的不同向其中加入Shape的不同子类对象(如是1,生成Circle对象;如是2,生成Rectangle对象;如是3,生成Star对象)。然后将Vector中元素依次取出,判断其是否为Star类。如是返回其是个Star。否则返回其面积。-Personal original code: the operation of the rectangular, circular, five-pointed star shape.The Shape to write java application program to create an interface, including the area of abstract methods, the Circle class, the Rectangle area method to calculate the area and return. Another Star Shape of area method, the return value is 0, the Star class, otherwise returns the value of a boolean method isStar in the main method to create a Vector, according to the random number to join Shape subclass object (in the case of 1, generate a Circle object case 2, generate the Rectangle object the case of three objects generate Star). Vector elements turn out to determine whether it is the Star class. The case of return is a Star. Otherwise, return to their area.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
本Java程序设计详细要求.txt
ShapeExp2.java
ShapeExp2.java
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.