版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、封:o:线总分二三四五东北大学考试试卷(A 卷)2012 2013 学年第 一 学期课程名称:面向对象程序设计| I.Single Choice (20 points,2 points each) TOC o 1-5 h z From within a child class, its parent class is referred to via the keyword?()(A) this (B)Base(C) Super(D)parentClasses from which of the following packages are implicitly imported into ev
2、ery Javaprogram?()(A) java.lang (B) java.util (C) java.awt (D) java.ioIn Java, the default layout manager for a JPanel component is ()BorderLayout (B) GridLayout (C) GridBagLayout (D) FlowLayoutThe Strategy design pattern is likely to be useful when implementing which of the following?()An applicati
3、on that offers several alternate sorting algorithmsA simple class to store the address of an organization of which only one instance can be instantiatedNone(B) I only (C) II only(D) I and IIIf the length of a particular array is the value of LIMIT, what is the index of the last item in thatarray?()L
4、IMIT (B) 0(C) LIMIT / 2(D) LIMIT - 1Which of the following statements is not true of the class java.util.ArrayList?()An instance of ArrayList can grow to accommodate new items when the collection is full.Once an object is inserted into an instance of ArrayList, it can never be removed.Items stored b
5、y an instance of ArrayList can be accessed using integer indexes.The constructor of the ArrayList class, when called with no arguments, causes an empty ArrayList to be constructed.If a file opened for reading does not exist, which of the following events will occur in Java?()A NullPointerException w
6、ill be raised.A new file will be createdA run-time error will occurA FileNotFoundException will be raised.A design pattern is typically used to ()allow the use of object-orientated concepts in a language that is not object-orientedreduce the number of classes in the design of a programensure that co
7、de executes at optimal speed during runtimedescribe a practical solution to a common design problemWhich of the following statements is (are) true in Java?()I Classes that contain abstract methods must be declared abstract.Classes that contain protected methods must be declared abstract.(A) I and II
8、 (B) I only (C) II only (D) None| II. Fill in blanks. (10 points, 1 point each )A design pattern can sure to make only one object in the software system.In a UML class diagrams representation of a class, the top, middle, and lower rectangular compartments respectively describe the , and of the class
9、.In an object model, the data that an object is responsible for maintaining are representedby.The data in a interface must be and .7 A collection typically models a relationship?()(A) many-to-many(B) zero-to-one(C) one-to-many(D)one-to-one , and are the base characters of Object-Oriented Programming
10、.III. Design a simple Book Seller System with strategy pattern. (25 points)You dont care all the functions of the system.There are three kinds of client which include VIPMember(0.9*price), NormalMember(1*price), SuperMember(0.8*price). They have the different discount when they buy book from the sys
11、tem.You must use strategy pattern when you design the system.Firstly, you should give the UML class diagram with the strategy pattern. (5 points)Secondly, you should write the code for each class you design in the UML. (15 points)Thirdly, you should write a class named Test which include a main() me
12、thod, we support there are three clients named Tom(VIPMember), John(NormalMember) and Mike(SuperMember). The class you write can sell a book to the three clients. We support the price of the book is 150.(5 points) Your UML is here.o:线 Place your code here. (You can write the codes in the back surfac
13、e of the paper or the next paper, but you must write your code clearly.)Fig 1 Student Information Management Applicationo:线IV. Create an Student information Management application as shownFig. 1 using Swing GUI. Part of the work has been done. You should finish the code. (30 points)import java.awt.*
14、;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.PrintWriter;import javax.swing.*;/*Demonstrates the component link JTextField. This class extendsclass link JPanel.*/public class StudentManagem
15、ent extends JPanel private JLabel labelName;private JLabel labelNo;private JLabel labelGender;private JTextField textFieldName;private JTextField textFieldNo;private JTextField textFieldGender;JButton addStudentButton;JButton submitButton;public static void main(String args) JFrame frame = new JFram
16、e(学生信息增加”);frame.setContentPane(new StudentManagement();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setVisible(true);Creates three link JLabel components , three link JTextField班级O学号姓名components, one textArea and two buttons here.*/public S tudentManagement() setLayout(ne
17、w GridLayout(5, 1);setB ackground(Color.white);/Place your code here, Create the components. (5 points)封:/ Place your code here, Add components to the container. (5 points)class AddStudentListener implements ActionListener(public void actionPerformed(ActionEvent event)(/ Place your code here, add st
18、udent information into textarea. (6 points)/ Place your code here, regist the AddStudentListener to addStudentButton. (4 points) class storeStudentListener implements ActionListener(public void actionPerformed(ActionEvent event)(/ Place your code here. Store the Students which in the textarea into f
19、ile output.txt. Try to catch the Exception. (6 points)/ Place your code hereegist the storeStudentListener to submitButton. (4 points)In the car rental system, the user should be able to: V. Read the following Car Rental System Specification and Create a UML class Diagram for this System. (15 points
20、)Car Rental System SpecificationThe car rental system maintains customers, cars and rental records.New customers may register as users of a car rental company by providing their personal information such as name, address and telephone number. For each new customer, the system provides a rental card
21、with a bar code(条形码)representing their his/her unique identification number. Each car also has a bar code representing its unique identification number. When a customer wants to rent a car, he/she presents his/her rental card, together with the chosen car. A rental record then is added to the system
22、. When a car is returned by a customer, the cars bar code is scanned so that the systems records can be updated as necessary. The system can add cars to, or withdraw cars from (报废的车辆不再出租,收回), the recorded stock by supplying appropriate details. In addition, the system can generate a management report, on request
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 45410.7-2026光学和光子学望远镜系统试验方法第7部分:极限分辨力
- 护理同理心的情感与认知基础
- 护理质量事件处理
- 湖北省宜昌市2025-2026学年高二下学期期中考试语文试卷(含答案)
- 智能体构建与应用开发(Python+LangChain)(微课版)课件 项目3、4 熟悉LangChain开发基础、实现对话上下文记忆管理
- 电子设备调试工诚信品质考核试卷含答案
- 保健拔罐师诚信品质竞赛考核试卷含答案
- 2026年新科教版高中高一历史下册第三单元辛亥革命影响卷含答案
- 混凝土机械维修工岗前岗位实操考核试卷含答案
- 热注运行工道德知识考核试卷含答案
- 2026广东东莞市城市管理和综合执法局招聘编外聘用人员6人备考题库及答案详解(真题汇编)
- 2026年7月浙江高中学业水平合格考生物试卷试题(含答案详解)
- 2026年真空镀膜机电源行业分析报告及未来发展趋势报告
- 2025年劳动保障监察大队招聘考试真题(附答案)
- 煤矿尽职调查报告
- 2026年高中历史教师招聘试题及答案
- 2025年《青铜葵花》(曹文轩)阅读测试题和答案
- (完整版)气体灭火系统安装施工方案
- (正式版)T∕CPCPA 0017-2026 托育机构婴幼儿回应性照护服务规范
- (2026版)视网膜中央动脉阻塞神经介入专家共识课件
- 2025年四川省广元市八年级地理生物会考考试真题及答案
评论
0/150
提交评论