版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、封:o:線總分二三四五東北大學(xué)考試試卷(A 卷)2012 2013 學(xué)年第 一 學(xué)期課程名稱:面向?qū)ο蟪绦蛟O(shè)計| 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(學(xué)生信息增加”);frame.setContentPane(new StudentManagement();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setVisible(true);Creates three link JLabel components , three link JTextField班級O學(xué)號姓名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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 西華師范大學(xué)《外國戲劇史》2022-2023學(xué)年第一學(xué)期期末試卷
- 西昌學(xué)院《廣告攝影》2022-2023學(xué)年第一學(xué)期期末試卷
- DB51-T 3051-2023 四川省行政執(zhí)法用語規(guī)則
- 單位司機合同范例
- 打地面勞務(wù)合同范例
- 2025屆高考政治一輪復(fù)習(xí)第2單元生產(chǎn)勞動與經(jīng)營學(xué)案必修1
- 統(tǒng)考版2025屆高考?xì)v史一輪復(fù)習(xí)課后限時集訓(xùn)二十七20世紀(jì)以來中國的重大思想理論成果含解析北師大版
- 2024-2025學(xué)年高中政治第二單元為人民服務(wù)的政府4.1政府的權(quán)力:依法行使作業(yè)含解析新人教版必修2
- 擔(dān)保合同范例寫書
- 影視版權(quán)采購合同范例
- 第5課 文化變革 美術(shù)發(fā)展 課件 【高效課堂+備課精研】 高一美術(shù)魯美版美術(shù)鑒賞
- pep 三年級英語課本人物介紹PPT課
- 2023年北京清華附中小升初考試數(shù)學(xué)真題及答案
- 希沃優(yōu)化大師操作培訓(xùn)
- 氧氣吸入法(課堂)課件
- 智慧城市綜合管線信息化解決方案智慧管網(wǎng)智慧管線課件
- 務(wù)工證明excel模板
- 國際商法說課課件
- ICF言語嗓音障礙的評估與治療課件
- 《中國當(dāng)代文藝思潮》第二章主體論文藝思潮
- Honda-Special-Requirement本田的特殊要求-課件
評論
0/150
提交評論