《《面向对象程序设计》试题.pdf》由会员分享,可在线阅读,更多相关《《面向对象程序设计》试题.pdf(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、1/8 一、程序修改(20分)说明:描述程序中的语法错误原因并修改,每小题4分,错误原因和改正错误各2分。1.isPrime方法用于检查参数num是否是质数。public boolean isPrime(int num)boolean result=false。for(int i=2。i=num)result=true。return result。2.具体类 Reader 实现了 Readable 接口。interface Readable void read()。class Reader implements Readable void read()System.out.println(I
2、Can read it.)。3.main方法调用重载的max方法求 2 个数的最大值。public class Error03 public static double max(int a,double b)return a b?a:b。public static double max(double a,int b)return a b?a:b。public static void main(String args)double c=max(10,100)。4.子类 Child覆盖了父类Parent 中的 output方法。class Parent public final void outp
3、ut()System.out.println(Parent)。class Child extends Parent public void output()System.out.println(Child)。5.main方法调用sum方法求数组所有元素的和。public class Error05 public double sum(double array)double result=0。for(double value:array)result+=value。return result。public static void main(String args)double arr=1.0,2
4、.0,3.0,4.0,5.0。System.out.println(sum(arr)。得分得分2/8 二、程序填空(20分)说明:填充程序中的空白,使程序能够正确运行,每空2分。1.以下程序功能为输入多个班的考试成绩,并分别计算每个班的总成绩。import java.util.Scanner。public class Score /inputScore方法用于输入一个班的所有成绩,参数num是班级的学生人数 public static double inputScore(int num)double array=new doublenum。Scanner scanner=new Scanner
5、(System.in)。for(int i=0。i(1)。i+)arrayi=scanner.nextDouble()。return array。public static double sumScore(double array)double result=0。for(int i=0。i array.length。i+)result+=arrayi。return result。public static void main(String args)double scores。int numOfClass,numOfStudent。Scanner scanner=new Scanner(Sys
6、tem.in)。System.out.print(一共有几个班?)。numOfClass=scanner.nextInt()。scores=(2)。for(int i=0。i numOfClass。i+)System.out.println(第+(i+1)+班有几人?)。numOfStudent=scanner.nextInt()。scoresi=inputScore(3)。for(int i=0。i numOfClass。i+)System.out.print(第+(i+1)+班的总分:)。System.out.println(sumScore(4)。2.以下程序定义了Circle和Cyli
7、nder两个类。/类 1,Circle.java public class Circle private double radius。/圆的半径 public Circle()/无参构造方法 (5)/调用有参构造方法将radius初始化为0.0 文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R
8、2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V
9、8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3
10、C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M
11、2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W
12、4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9
13、Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C43/8 publi
14、c Circle(double radius)(6)/把参数 radius赋给数据域radius public double getArea()return (7)。/求圆的面积,使用Math.PI public double getRadius()return radius。public void setRadius(double r)radius=r。/类 2,Cylinder.java public class Cylinder extends Circle private double height。/圆柱的高度 public Cylinder()/无参构造方法 this.height
15、=0.0。public Cylinder(double radius,double height)(8)。/调用父类构造方法将radius初始化为参数radius this.height=height。Override public double getArea()double area1=(9)。/求圆柱表面积double area2=(10)。/求圆柱的底面积return area1+area2。public double getHeight()return height。public void setHeight(double height)this.height=height。三、阅读
16、程序(20分)说明:阅读以下每段程序,写出运行的结果,每小题5分。1.阅读程序1 class Data public int a=10,b=100。public class Read01 public static void main(String args)int a=10,b=100。得分文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8
17、ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档
18、编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X
19、9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M
20、8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4
21、文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R
22、2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V
23、8M8 ZP8C1K9Z3C44/8 int array=10,100。Data data=new Data()。System.out.println(a=+a+,b=+b)。System.out.println(array0=+array0+,array1=+array1)。System.out.println(data.a=+data.a+,data.b=+data.b)。swap(a,b)。swap(array)。swap(data)。System.out.println(a=+a+,b=+b)。System.out.println(array0=+array0+,array1=+arr
24、ay1)。System.out.println(data.a=+data.a+,data.b=+data.b)。public static void swap(int a,int b)int t=a。a=b。b=t。public static void swap(int array)int t=array0。array0=array1。array1=t。public static void swap(Data data)int t=data.a。data.a=data.b。data.b=t。2.阅读程序2 public class Read02 public static void main(
25、String args)A x=new B()。System.out.println(1)x.i:+x.i)。System.out.println(2)(B)x.i:+(B)x).i)。System.out.println(3)x.j:+x.j)。System.out.println(4)(B)x.j:+(B)x).j)。System.out.println(5)x.m1():+x.m1()。System.out.println(6)(B)x.m1():+(B)x).m1()。System.out.println(7)x.m2():+x.m2()。System.out.println(8)x.
26、m3():+x.m3()。class A public int i=1。public static int j=11。public static String m1()return 类 A的静态方法m1.。public String m2()return 类 A的实例方法m2.。public String m3()return 类 A的实例方法m3.。class B extends A public int i=2。public static int j=22。public static String m1()return 类 B的静态方法m1.。public String m2()retur
27、n 类 B的实例方法m2.。文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C
28、4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2
29、R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4
30、V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z
31、3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2
32、M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9
33、W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C45/8 3.阅读程序3 class Person public Person()System.out.println(Person()。class Employee extends Person public Employee()thi
34、s(调用 Employee(s)。System.out.println(Employee()。public Employee(String s)System.out.println(s)。class Faculty extends Employee public Faculty()System.out.println(Faculty()。class Test public static void main(String args)new Faculty()。4.阅读程序4,分别写出?处的值是30 和 50 的输出结果。public class Read04 public static void
35、 main(String args)int value=?。try if(value40)throw new Exception(value is too small)。System.out.println(value=+value)。catch(Exception e)System.out.println(e.getMessage()。finally System.out.println(process finished)。System.out.println(program continued)。四、程序设计(40 分)1.设计并编写一个名为MyPoint 的类表示平面上一个具有x 坐标和
36、y 坐标的点,完成以下要求:(15 分)将该类放置于包prog01 中;两个 double 类型数据域x 和 y 表示坐标,并进行封装;无参构造方法创建点(0.0,0.0)。有参构造方法按指定坐标创建一个点;方法 distance返回当前点对象到参数点对象之间的距离;编写测试类TestMyPoint,其main 方法中创建两个点(0.0,0.0)和(10.0,35.5),输出这两个点之间的距离。文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA
37、10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP
38、8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码
39、:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9
40、HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8
41、ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档
42、编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X
43、9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C46/8 2根据材料完成程序代码(15 分)。要求利用多态性计算若干不同类型几何图形的面积之和,类与接口的关系见下面的类图。类 CricleV1,类 RectangleV1 和测试类Tester的源码已经给出。CircleV1.java public class CircleV1 private double radius。public CircleV1()this(1.0)。public CircleV1(double radius)this.radius=ra
44、dius。public double getRadius()return radius。public void setRadius(double radius)this.radius=radius。RectangleV1.java public class RectangleV1 private double width。private double height。public RectangleV1()this(1.0,1.0)。public RectangleV1(double width,double height)this.width=width。this.height=height。
45、public double getWidth()return width。public void setWidth(double width)this.width=width。public double getHeight()return height。public void setHeight(double height)this.height=height。Tester.java public class Tester public static void main(String args)Object shapes=new CircleV2(10),/new RectangleV2(10
46、,2),/new CircleV2(),/new RectangleV2()/。System.out.println(sumArea(shapes)。public static double sumArea(Object shapes)文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 H
47、A10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 Z
48、P8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编
49、码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9
50、 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8 ZP8C1K9Z3C4文档编码:CR1Y2M2R2X9 HA10F9W4V8M8