1/4
Java Programming 2014
Course Code: EBU4201
Mini Project
Task 1 [30 marks]
SmileyCount is a simple application used by children to practise their counting and adding skills (see Figure 1).
Figure 1 First launch with some input values entered
A random number of Smiley images ranging from 1 to 10 are displayed for each operand and the user is expected to enter the values of the two operands and the result of adding the two operands, in the given text fields. When the user clicks on the button ‘Check!’, one of two things can happen:
Case 1: all three input values are correct
i) the text changes to ‘"Correct! Have another go?"’. ii) the number of Smiley images displayed for each of the two operands changes. See Figure 2 for an example.
iii) the three text fields are reset (i.e. they are left empty). Case 2: at least one of the input values entered is incorrect i) the text changes to ‘Wrong! Try again!’. ii) the number of Smiley images displayed does NOT change. iii) the text fields do NOT change.
2/4
Figure 2 Action following Case 1
Implement SmileyCount as a Java application. You application must satisfy ALL the specific requirements given below:
a) The title of the top-level container must be ‘Welcome to SmileyCount!’.
b) The initial text should be ‘Enter two operands, result and click on 'Check!'’. See Figure 1.
c) The maximum number of Smiley images per row is FOUR. See Hint 1.
d) The text fields should be wide enough to display at least TWO characters.
e) The button ‘Check!’ must not resize when the GUI is resized. See Hint 2 and Figure 3.
f) The ‘plus sign’ icon should appear vertically centered between the two sets of smiley images and must not resize when the GUI is resized. See Hint 2 and Figure 3.
g) When first launched and whenever a correct answer is given, the number of displayed Smiley images for each operand should change to any number between 1 and 10 (inclusive). See Hint 3 and Hint 4.
Note: It is possible for the next number(s) to be the same as the current number(s).
h) Nothing should happen if the user clicks the ‘Check!’ button while at least one of the text fields are empty, i.e. no errors should be thrown in this case. Note: You can assume that only a numeric value will be entered into the text fields.
Hint 1: Use an array of JLabel components for the Smiley images. The following constructor may be helpful for the ‘plus sign’ icon.
public JLabel(Icon image)
A Smiley image and ‘plus sign’ image will be provided. You must use these images.
Hint 2: Consider using containers within other containers and using layouts intelligently.
Hint 3: Suggested approach for displaying images: look up the following method in the class javax.swing.JLabel.
public void setIcon(Icon icon)
Hint 4: Suggested approaches for displaying a variable number of images: classes java.util.Random OR java.lang.Math.
3/4
Note: All the necessary files should be placed in a directory called Task1.You can choose whether to place the image files directly under Task1 or within a sub-directory. Whichever approach you take, the images must be displayed on the GUI without the markers having to move the image files to different locations within your directory structure. Also note that your application must run as expected from the command line.
Figure 3 GUI Resized
Task 2 [10 marks]
You may notice that entering a non-numeric value and clicking the ‘Check!’ button will cause a run-time error on the console. Therefore, your second task is to improve the application developed in Task 1 to ensure the user is only allowed to supply valid input values, i.e. a number between 1 and 10 (inclusive). The application must still function as specified in Task 1 although you may remove the ‘Check!’ button if you wish.
Hint: Use another appropriate component in place of the text field.
Note: All the necessary files (including any reused ones from Task 1) should be placed in a directory called Task2.
4/4
Documentation [10 marks]
You must include:
a. Generated Javadocs
b. Internal comments in your code.
c. User Manual. This should be no more than 2 pages and include how to run the program (both how to start and how to use it).
Note: All documentation files should be placed in a directory called Documentation.
Extra Credit [5 marks]
Extra marks from this section can be used to top up your final grade for this project. Maximum mark is still 50.
Further improve your application such that the maximum number of Smiley images displayed for each operand can be any number between 10 and 20 (inclusive), specified as a command line argument. E.g. assuming your class is called SmileyCountExtra, the command
Java SmileyCountExtra 25
will launch a GUI similar to Figure 1 where the maximum number of Smiley images displayed per operand will be 25. Whenever a correct answer is entered, the number of Smiley images per operand will change to any number between 1 and 25 (inclusive). The maximum number of images per row must now be FIVE.
If no command line argument is given OR a number outside the valid range is given, the program must terminate printing out an appropriate error message to the console. You can assume only a numeric value will be given as the argument.
Note: All the necessary files (including any reused ones from Task 1 and Task 2) should be placed in a directory called ExtraCredit.
Important notes:
1. All three directories must be included in a zip file. The filename must be your QM Student Number.
2. You should design your classes properly, following object oriented principles. E.g. do NOT write everything in the main method, keep code repetition to a minimum (i.e. use methods), do NOT use static methods unless there is a good reason. There will be marks allocated to good design.
- 浏览: 1010239 次
文章分类
最新评论
-
18335864773:
很多公司项目 都在使用pageoffice 来操作word,e ...
用java生成word文档 -
Gozs_cs_dn:
请问下博主, 怎样将sitemesh3.xsd绑定 sitem ...
SiteMesh3配置 -
Rose_06:
springside4.0quick-start.bat报错原因 -
ilemma:
我也是刚参见工作啊,经理让自学这个,有些东西不太懂,能不能发个 ...
Apache Shiro在Web中的应用 -
shanbangyou:
你废了
程序员上班打酱油的方法
发表评论
-
递归归并排序
2016-02-11 20:26 353/* MergeSort.java CSC 225 - ... -
java冒泡排序对布尔类型进行排序
2015-12-11 23:06 647QQ 928900200 程序代写 java不能对 ... -
判断宏是否是“安全”的
2014-11-22 22:54 562给了一系列C++的宏定义,问你一个表达式是否是“安全”的。 ... -
C语言求平均值
2014-11-19 19:14 559木其工作室:QQ928900200 Computing I ... -
C语言连连看
2014-11-18 16:34 604(1)定义一个矩阵,随机产生字符布置地图,例如下面这个4x ... -
The Monty Hall Problem
2014-10-19 12:58 641GNG1106 Lab 3The Monty Hall Pro ... -
java类
2014-10-16 08:27 303木其工作室 qq 928900200 You are ... -
ECE/CPSC 3520
2014-10-13 09:49 537ECE/CPSC 3520Fall 2014Software ... -
计算机安全
2014-10-07 14:52 435CS461 MP 1: Due Wednesday 09/17 ... -
java星球机器人建模UML
2014-10-06 22:29 398Your task is to design and imp ... -
数据库sql
2014-10-06 22:25 613service QQ 928900200 ... -
C语言 cgi(3)
2014-08-04 09:17 3511cs3157 – Advanced ProgrammingS ... -
C语言 cgi(2)
2014-08-04 09:10 3051Columbia Universitycs3157 – Ad ... -
C语言cgi(1)
2014-08-04 09:08 3351Columbia Universitycs3157 – Ad ... -
c++ input,output
2014-08-04 08:37 471You should be comfortable w ... -
Array of Objects
2014-08-04 08:30 661You should be comfortable w ... -
bat脚本打开网页
2014-07-13 09:54 889start iexplore "http://ww ... -
java 汉诺塔实现自动演示
2014-07-10 11:53 5091、增加计时功能,显 ... -
代写java程序qq:928900200
2014-06-18 12:46 3学校为全面提升学校教学质量,提高管理水平,决定开发一套小型成 ... -
基于MVC的系统代写
2014-06-16 12:13 445人力资源管理系统 完成系统静态页面设计,页面数 ...
相关推荐
为您提供最贴心的服务,小泽竭诚为您服务. 定制,代写都是十元起价,小泽保证在能力范围内,尽量为您提供最精良的代码. ------DreamDimension
标题和描述中提到的文件是一份与Java程序设计相关的留学生作业资料。该作业主要涉及构建一个专门用于天体对象(Astronomical Objects,简称AOs)的索引式网络浏览器项目。以下是这份作业资料中所涉及的IT知识点: 1...
4. **JDBC**:Java数据库连接(JDBC)是Java访问数据库的标准API,虽然MyBatis等高级框架已经封装了JDBC,但理解JDBC基础对于数据库操作仍然至关重要。 5. **Servlet和JSP**:Servlet是Java Web服务器端编程的基础...
代写C程序 C++ Linux Unix 数据结构 操作系统
该程序例子为用户提供了如何有效利用SIWAREX FTC模块进行失重秤控制的参考。 首先,我们要理解SIWAREX FTC的核心功能。它是一个集成在SIMATIC自动化系统中的称重技术组件,能够提供高精度的重量测量和控制。FTC代表...
Qt结合C++技术实现截屏,在Qt5.4下实现编译通过,并实现截屏功能,如果对代码有不懂或者编译错误,请联系QFGL(代写软件:2120263292 )!
程序代开发,代写程序。 通讯配置,辅助测试。 信捷PLC无程序网络通讯实现。 常用功能一网打尽。 1.命令帧读写。 2.支持 I16 I32 Float 批量读写。 3.支持字符串读写。 4.支持XYMBool批量读写。 5.支持YM单点读写。 ...
程序代开发,代写程序。 通讯配置,辅助测试。 信捷PLC无程序网络通讯实现。 常用功能一网打尽。 1.命令帧读写。 2.支持 I16 I32 Float 批量读写。 3.支持字符串读写。 4.支持XYMBool批量读写。 5.支持YM单点读写。 ...
1. **Java编程**:Java是一种跨平台的面向对象的编程语言,适合开发大型分布式应用。在这个系统中,Java用于编写业务逻辑、控制层、数据访问层等模块,利用其强大的类库和面向对象特性来实现功能。 2. **Oracle...
代写个人述职报告.docx
程序代开发,代写程序。 通讯配置,辅助测试。 FX3U无程序网络通讯实现。 常用功能一网打尽。 1.命令帧读写。 2.支持 I16 I32 Float 批量读写。 3.支持字符串读写。 4.支持XYMBool批量读写。 5.支持YM单点读写。 ...
"律师代写遗嘱范本.docx" 本资源摘要信息中,我们将对律师代写遗嘱的概念、法律规定、格式和实践操作进行详细的解释和分析。...在实践中,律师代写遗嘱需要注意到遗嘱人的口述内容、见证人的公正性和程序上的公正性。
9. **法律援助服务**:提供免费代写起诉状的服务,表明了法律专业人士在公民维护自身权益过程中的重要角色,他们可以帮助公民正确、有效地进行法律诉讼。 10. **法律意识的培养**:案例提醒公众,合同无小事,签订...
秀视频--小程序社交软件线上版简介:简介随着微信的普及,小视频的流行,我们设计一款基于微信小程序端的视频社交软件 + 后台管理系统作为自己专科毕业设计----秀视频-微信小程序端(短视频社交小程序,用户可以在小...
这是DBMaker 5.1数据库sample中的一个范例代码,挺简单的,目录中还有一个readme_cn.txt,说的还算清楚易懂,应该很容易用连接到其他数据库上
注:里面附带备注,相对而言通俗易懂,唯一不足之处在于没有将数据存放在txt文档,大致功能已经实现,以供参考。 题目要求:建立餐饮菜品评价管理系统,实现用户对餐厅的菜品进行评价,要求在结构体数组的基础上,...
【后端】:Java 【框架】:springboot 【前端】:vue 【JDK版本】:JDK1.8 【数据库】:mysql 5.7+ 包含:项目源码、数据库脚本等,该项目源码可作为毕设使用。 项目都经过严格调试,确保可以运行! 具体项目介绍可...
【后端】:Java 【框架】:springboot 【前端】:vue 【JDK版本】:JDK1.8 【数据库】:mysql 5.7+ 包含:项目源码、数据库脚本等,该项目源码可作为毕设使用。 项目都经过严格调试,确保可以运行! 具体项目介绍可...
【后端】:Java 【框架】:ssm 【前端】:vue/jsp 【JDK版本】:JDK1.8 【服务器】:tomcat7+ 【数据库】:mysql 5.7+ 包含:项目源码、数据库脚本等,该项目源码可作为毕设使用。 项目都经过严格调试,确保可以...