西南交通大学JAVA期末作业
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
平时程序期末提交
一、题目
提交内容:在本学期布置的作业中任选五题,每章只能选择1题,提交源程序(含必要注释)。另写一份word文档,注明所做题目题号,内容,对应文件名称,并绘制其中任意2个程序对应的UML图。
二、第2章选题
题目:PP2.5 Write an application that converts miles to kilometers. Read the miles value from the user as a floating point value.
运行结果:
源程序见miles2kilometers.java。
三、第3章选题
题目:PP3.7 Write an application that displays a frame containing two labels that display your name, one for your first name and one for your last. Experiment with the size of the window to see the labels change their orientation to each other.
运行结果:
四、第4章选题
题目:PP2.5 Write an application that converts miles to kilometers. Read the miles value from the user as a floating point value.
运行结果:
五、第5章选题
题目:PP 5.16 Develop a simple tool for calculating basic statistics for a segment of text. The application should have a single window with a scrolling text box ( a JTextArea) and a stats box. The stats box should be a panel with a titled border, containing labeled fields that display the number of words in the text box and the average word length, as well as any other statistics that you would like to add. The stats box should also contain a button that, when pressed, recomputes the statistics for the current contents of the text field.
运行结果:
以Hans Christian Andersen的《A CHEERFUL TEMPER》统计
特别在被引用的PCount类中加入提示信息
源程序。
六、第7章选题
题目:1. Design and implement a program that displays a numeric keypad that might appear on a phone. Above the keypad buttons, show a label that displays the numbers as they are picked. To the right of the keypad buttons, include another button to clear the display. Use a border layout to manage the overall presentation, and a grid layout to manage the keypad buttons. Put a border around the keypad buttons to group them visually, and a border around the display.
运行结果:
源程序。
UML类图: