ImageVerifierCode 换一换
格式:DOC , 页数:13 ,大小:240KB ,
资源ID:2768978      下载积分:20 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-2768978.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(《Java面向对象程序设计》科目考试卷及答案.doc)为本站会员(dzzj200808)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

《Java面向对象程序设计》科目考试卷及答案.doc

1、第 1 页 共 10 页安徽财贸职业学院 20112012 学年第二学期Java 面向对象程序设计期末试卷( B 卷)适用班级:软件 1101 一、单选题(每小题 1 分,共 30 分)1在 MyEclipse 中, ( )视图可以将项目中包含的文件及层次结构展示出来。A) Package B)Declaration C)Navigator D) Console2下列标识符中,正确的是( ) 。A)class B) 123_rr C) _lei D) testdo +k ;while(k0;29请问所有的异常类皆继承哪一个类?( ) 。A)java.io.Exception B)java.la

2、ng.ThrowableC)java.lang.Exception D)java.lang.Error30对于 catch 子句的排列, 下列哪种是正确的( ) A)父类在先 ,子类在后 B)子类在先,父类在后 C)有继承关系的异常不能在同一个 try 程序段内 D)先有子类,其他如何排列都无关 二、填空题(每空 2 分,共 20 分)1Java 有_、_和 JavaME 三个版本。2Java 源程序文件编译后产生的文件称为_ 文件,其扩展名为_。3面向对象编程的三大特性是_、_和多态。4_方法是一种仅有方法头,没有具体方法体和操作实现的方法,该方法必须在抽象类之中定义。_方法是不能被当前类的

3、子类重新定义的方法。5子类必须通过_关键字调用父类有参数的构造函数。6在 Java 程序中,通过类的定义只能实现单重继承,但通过_ 的定义可以实现多重继承关系。三、阅读理解题(每题 4 分,共 20 分)1下列程序段的运行结果为_。int a=1;while(a16 座日租费(元 /天) 600 500 300 800 1500具体要求:车辆分为轿车和客车两大类,它们都继承自抽象类 MotoVehicle,并实现其抽象方法 calRent()。请根据下面给出的类图分别创建三个类,并在测试类 TestRent 中实现车辆的租赁。租赁过程如图 2 所示。Car-type:String+Car(no

4、,brand,type)+getType():String+ calRent():intBus-seatCount:int+Bus(no,brand,seatCount)+getSeatCount ():String+calRent():intMotoVehicle-no:String-brand:String+ MotoVehicle ()+MotoVehicle (no,brand)+getNo():String+getBrand():String+calRent():int图 2第 9 页 共 10 页安徽财贸职业学院 20112012 学年第二学期 Java 面向对象程序设计期末试卷答

5、题卡( B 卷)适用班级:软件 1101一、单选题(每小题 1 分,共 30 分)1 2 3 4 5 6 7 8 9 1011 12 13 14 15 16 17 18 19 2021 22 23 24 25 26 27 28 29 30二、填空题(每空 2 分,共 20 分)1_ _2_ _3_ _4_ _5_ 6_三、阅读理解题(每题 4 分,共 20 分)1_ 2_3_ 4_5_题号 一 二 三 四 总分得分得分 评卷人得分 评卷人得分 评卷人班级 考号 姓名 装订线 第 10 页 共 10 页四、编程题(共 30 分)1 (每空 3 分,共 9 分)【1】_ 【2】_【3】_2 (7

6、分)3 (14 分)得分 评卷人第 1 页 共 3 页安徽财贸职业学院 20112012 学年度第二学期Java 面向对象程序设计期末试卷答案( B 卷)适用班级:软件 1101一、单选题二、填空题1JavaSE JavaeE 2字节码 .class 3封装 继承4抽象(或 abstract) final 5super 6接口三、阅读理解题16 310.021 4a=604 b=209 c=30Totle is 14 5234四、编程题1 【1】entends Point 【2】super(a1,b1) 【3】Rec r1=new Rec(0,0,10,20)2import java.util

7、.Arrays;public class CharsSort public static void main(String args) char chars = new chara,c,u,b,e,p,f,z;System.out.print(“原字符序列:“);for(int i = 0; i = 0; i-)System.out.print(charsi + “ “);3public abstract class MotoVehicle private String no;/ 汽车牌号private String brand;/ 汽车品牌1 2 3 4 5 6 7 8 9 10C C D

8、D A A B B A D11 12 13 14 15 16 17 18 19 20C D B A C C B C A A21 22 23 24 25 26 27 28 29 30D D D D B C D C C B第 2 页 共 3 页public MotoVehicle() public MotoVehicle(String no, String brand) this.no = no;this.brand = brand;public String getNo() return no;public String getBrand() return brand;public abstra

9、ct int calRent(int days);public final class Car extends MotoVehicle private String type;/ 汽车型号public Car() public Car(String no, String brand, String type) super(no, brand);this.type = type;public String getType() return type;public void setType(String type) this.type = type;public int calRent(int d

10、ays) if (“1“.equals(type) / 代表 550ireturn days * 500; else if (“2“.equals(type) / 2 代表商务舱 GL8return 600 * days; else return 300 * days;public final class Bus extends MotoVehicle private int seatCount;/ 座位数public Bus() public Bus(String no, String brand, int seatCount) super(no, brand);this.seatCount

11、 = seatCount;public int getSeatCount() return seatCount;public void setSeatCount(int seatCount) this.seatCount = seatCount;public int calRent(int days) if (seatCount = 16) 第 3 页 共 3 页return days * 800; else return days * 1500;import java.util.Scanner;public class TestRent public static void main(Str

12、ing args) String no,brand,mtype,type;int seatCount,days,rent;Car car;Bus bus;Scanner input = new Scanner(System.in);System.out.println(“欢迎您来到汽车租赁公司!“);System.out.print(“请输入要租赁的天数:“);days=input.nextInt();System.out.print(“请输入要租赁的汽车类型(1:轿车 2、客车):“);mtype = input.next();if(“1“.equals(mtype)System.out.p

13、rint(“请输入要租赁的汽车品牌(1、宝马 2、别克):“);brand=input.next();System.out.print(“请输入轿车的型号 “);if(“1“.equals(brand)System.out.print(“(1、550i ):“);elseSystem.out.print(“(2、商务舱 GL8 3、林荫大道)“);type=input.next();no=“京 BK5543“;/简单起见,直接指定汽车牌号System.out.println(“分配给您的汽车牌号是:“+no);car =new Car(no,brand,type);rent=car.calRe

14、nt(days);elseSystem.out.print(“请输入要租赁的客车品牌(1、金杯 2、金龙):“);brand=input.next();System.out.print(“请输入客车的座位数:“);seatCount=input.nextInt();no=“京 AU8769“;/简单起见,直接指定汽车牌号System.out.println(“分配给您的汽车牌号是:“+no);bus=new Bus(no,brand,seatCount);rent=bus.calRent(days);System.out.println(“n 顾客您好!您需要支付的租赁费用是“+rent+“。“);

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报