SmileyCount.java

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.

SmileyCount.java笑脸加法程序代写(QQ:928900200)的更多相关文章

  1. c++程序代写(qq:928900200)

     1. Both main memory and secondary storage are types of memory. Describe the difference between the  ...

  2. C语言程序代写(QQ:928900200)

    1.学生成绩统计 要求描述: 用结构数组实现学生信息的统计功能. struct student { long no; /*学号*/ char name[10]; /*姓名*/ char sex; /* ...

  3. java程序开发代写(QQ:928900200)

    条件:手机1.2都是安卓智能机,手机1开热点,手机2链接手机1,功能:A手机2通过刷手机网页,登陆手机1设定的页面并下载其手机的指定文件,B手机1控制手机2的流量,当通过的流量多的时候,停止流量的供应

  4. 基于JAVA WEB技术旅游服务网站系统设计与实现网上程序代写

    基于JAVA WEB技术旅游服务网站系统设计与实现网上程序代写 专业程序代写服务(QQ:928900200) 随着社会的进步.服务行业的服务水平不断发展与提高,宾馆.酒店.旅游等服务行业的信息量和工作 ...

  5. 程序代写, CS代写, 代码代写, CS编程代写, java代写, python代写, c++/c代写, R代写, 算法代写, web代写

    互联网一线工程师程序代写 微信联系 当天完成 查看大牛简介特色: 学霸代写,按时交付,保证原创,7*24在线服务,可加急.用心代写/辅导/帮助客户CS作业. 客户反馈与评价 服务质量:保证honor ...

  6. CS代码代写, 程序代写, java代写, python代写, c/c++代写,csdaixie,daixie,作业代写,代写

    互联网一线工程师程序代写 微信联系 当天完成特色: 互联网一线工程师 24-48小时完成.用心代写/辅导/帮助客户CS作业. 客户反馈与评价 服务质量:保证honor code,代码原创.参考课程sl ...

  7. 模拟游客一天的生活与旅游java程序代写源码

    在某个城市的商业区里,有一家首饰店,一家饭店,一家面馆,一家火锅店,一家银行,一家当铺 现在有一群来自四川的游客,一群陕西的游客,一群上海的游客,和以上各店家的工作人员在此区域里,请模拟他们一天的生活 ...

  8. C++程序代写实现HashSet class

    C++程序代写实现HashSet class 专业程序代写(QQ:928900200) Implement a HashSet class for elements of type string.It ...

  9. 如何鉴别程序抄袭c语言程序代写

    如何鉴别程序抄袭:如何鉴别一份程序代码是抄袭另一份程序.输入:两个C语言源程序文件 输出:抄袭了多少?给出最相似的片段,判断是谁抄袭了谁? 提示:首先进行统一规范化排版,去掉无谓的空格.空行,然后比对 ...

随机推荐

  1. php插入上万条mysql数据最快的方法

    1.使用thinkphp框架 先生成包含所有数据的数组,再使用 addAll() 方法,插入1万条数据仅需3秒钟. 2.PHP原始方法: 将SQL语句进行拼接,使用 insert into table ...

  2. BZOJ.3620.似乎在梦中见过的样子(KMP)

    题目链接 /* 896kb 6816ms A+B+A是KMP的形式,于是固定左端点,对于每个位置i,若fail[i]所能到的点k中(k=fail[fail[fail[...]]]),有满足len(l~ ...

  3. 认证登录装饰器与form组件的使用

    def auth(func): '''制作登录认证的装饰器''' def inner(request,*args,**kwargs): user_info=request.session.get(se ...

  4. BZOJ2861 : 双向边定向为单向边

    将每条双向边拆成两条单向边,若两条边中至少存在一条边使得删掉它之后图中SCC个数不变,则这条边可以定向. 将边中间加上点,变成删点问题. 对于每个SCC单独考虑,随便选择一个不是拆点出来的点S作为源. ...

  5. Phone漂亮的动画

    //此处标明非原创 实现iPhone漂亮的动画效果主要有两种方法, 一种是UIView层面的, 一种是使用CATransition进行更低层次的控制, 第一种是UIView,UIView方式可能在低层 ...

  6. 第二章 flex输入输出

    flex程序默认总是从标准输入读取, 实际上,词法分析程序都从文件读取输入 flex总是通过名为yyin的文件句柄读取输入, 下面的例子,我们修改单词计数程序,使得它能从文件读取输入 /* even ...

  7. Linux下tomcat修改成的80端口无法访问

    转自: https://blog.csdn.net/u013252047/article/details/72834415 tomcat放到服务器上访问8080端口还需要输入端口号,造成访问不便,好多 ...

  8. 奇怪吸引子---FourWing

    奇怪吸引子是混沌学的重要组成理论,用于演化过程的终极状态,具有如下特征:终极性.稳定性.吸引性.吸引子是一个数学概念,描写运动的收敛类型.它是指这样的一个集合,当时间趋于无穷大时,在任何一个有界集上出 ...

  9. asp.net mvc Session RedisSessionStateProvider锁的实现

    最近项目用到了RedisSessionStateProvider来保存session,发现比内存session慢,后来慢慢了解,发现asp.net session是有锁的.我在文章 你的项目真的需要S ...

  10. TensorFlow进阶(二)---张量的操作

    张量操作 在tensorflow中,有很多操作张量的函数,有生成张量.创建随机张量.张量类型与形状变换和张量的切片与运算 生成张量 固定值张量 tf.zeros(shape, dtype=tf.flo ...