联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2023-05-30 09:24

F27SB Software Development 2

GUI Coursework 1: LayoutManager

Create a digital clock

a) Create the layout for your digital clock. The clock should have the following

layout:

so:

● HH - displays the hours

● MM - displays the minutes

● SS - displays the seconds

● AM/PM - displays whether it is before (AM) or after mid-day (PM).

The hours/minutes/seconds should be displayed in 36 point, italic serif.

(Correct layout: 0.25P,

Class extends JFrame: 0.25P,

Class follows OOP principles: 0.25P,

Global set-up in main method: 0.25P)1

b) Make the clock show the current time. For this you should use the Calendar

class from java.util with:

● Calendar.getInstance() - create Calendar object for current date/time

● get(field) - return integer field from Calendar object, where field may

be Calendar.HOUR, Calendar.MINUTE, Calendar.SECOND,

Calendar.AM_PM, etc.

● the value returned from Calendar.AM_PM may be compared with the values

Calendar.AM and Calendar.PM to determine if it is before or after mid-day

Create a function that runs continuously and updates the display to always show

the current time.

(Clock is updated when programme starts: 0.5P,

Clock is continually updated: 0.5P)

For more information about this class, see:

https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html.

1 Detailed explanation of points at the bottom of the document.

Create a progress meter

a) Many GUI applications have metres that indicate the progress made so far

towards completing an activity as a percentage of the anticipated total activity.

Write a program to display a progress metre as follows. The metre consists of a

window with a column of 11 labels. The first 10 labels indicate progress steps of

10% and are initially red. The bottom label shows the amount of activity remaining

as a textual percentage, and is initially set to “0%”.

(Correct layout: 0.25P,

Class extends JFrame: 0.25P,

Class follows OOP principles: 0.25P,

Global set-up in main method: 0.25P)2

b) Create functionality to simulate steps of 10% progress. For this the user

repeatedly presses return on the console inside Eclipse (use a Scanner object

for this). Every time, the top-most red label is changed to green and the progress

label value is incremented by 10 until that value is 100%. Make sure that no errors

occur if the user tries to go past 100%.

(Progress is shown when pressing enter: 0.5P,

Program stops reacting when 100% is reached: 0.5P)

Example output:

2 Detailed explanation of points at the bottom of the document.

Marking

In each coursework, you can achieve a total of 4 points. Each question awards different

amounts of points for different parts of the question. Partial completion of a task will

award the partial points listed underneath. Most descriptors of points are self-explanatory

in context of the task. Where further clarification is needed, you can find that below.

Your work will be checked by a lab helper during your assigned lab slot. Once all tasks

are checked, the points will be used to calculate your marks. Please, understand that the

lab helpers are not marking your work but are checking the completion of subtasks. As

part of this check, you will need to explain how you solved the given task. Only

successfully completed sub-tasks will award points.

The marks will be released on Canvas after the marking deadline has passed. This is not

an automatic process so please, be patient. Once the marks are released, you will be

notified via Canvas. Please, make sure to check your marks as soon as possible. If

there are any issues, please contact your teaching team immediately.

Collusion and Plagiarism

As mentioned above, you will need to explain your work during the demo session in the

lab. If you are not able to explain how you arrived at the solution to the task, we need to

assume that you did not do the work yourself. We do, however, know that you might be

anxious or nervous during the session. Please, rest assured that this is not an

interrogation and you can take all the time you need to explain your solution.

If there is reasonable doubt that you solved the given problems yourself, you will not get

any points for this task. If there are concrete indications that you copied your answer or

colluded with other students, we might also start an official investigation.

Please, make sure to fill and sign the Declaration of Student Authorship form for

each coursework and upload it to Canvas. If you do not upload the form, we will not

be able to give you any marks for this coursework.

If you feel unjustly accused of plagiarism or collusion, please contact your teaching team.

Coursework submission

Unless stated otherwise, all code parts of your work need to be committed and pushed to

your GitLab fork. You need to upload the Declaration of Student Authorship to Canvas,

and you need to present your solution to a lab helper. If you fail to do any one of these

steps, you will not be awarded any marks.

The deadline for submission can be seen on Canvas. You will need to present your

work to a lab helper any time before the deadline during your allocated lab slot. If

you do not manage to present your work before the deadline, you can do so at the first

lab after the deadline but will incur a 30% late penalty. If this late submission was caused

by issues out with your control, you can apply for mitigating circumstances to have this

late penalty removed.

If you also fail to present your work at the lab following the deadline, we will not be able to

give you any marks for your work. Similarly, if this was caused by circumstances out with

your control, you should apply for Mitigating Circumstances.

Please, note that we are not allowed to give individual extensions. If you cannot

submit your work on time, you will need to apply for Mitigating Circumstances.

Explanation of Points

Correct layout: Where an image or text explanation of the layout is given, points are

awarded for exactly achieving the required layout. You are free to choose a different

layout that you find more appealing as long as all the same components are used. This

means you might want to choose a different layout manager or different positioning but

you should still make sure to have the same amount of labels, panels, buttons, etc. If an

example of a layout is given, you are required to match this layout as closely as possible.

Class extends JFrame: The class that declares and initialises all the GUI components

should be a subclass of JFrame and correctly use the methods and variables provided by

its super class to achieve the desired layout.

Wrong Wrong Right

public static void main() {

JFrame f = new JFrame();

f.add(new JLabel());

public class A {

public A() {

JFrame f = new JFrame();

f.add(new JLabel());

public class A extends JFrame {

public A() {

add(new JLabel());

Class follows OOP principles: You should endeavour to reduce coupling and increase

cohesion in your code. That means you should check that every class is responsible for

its own components and data and that you do not provide unnecessary public variables or

methods. Always think about how someone else could use your class in a different

project. Refer to all the guidance given in the first half of the course and make sure to

highlight this to the lab helper when explaining.

Global set-up in main method: When you think about someone using your code in their

larger GUI, do you think they are happy that the name, size, position, and visibility is

defined inside the class where it cannot easily be changed? Make sure to only define

these things in the main method where you create a new instance of your class as we do

in the lectures.


相关文章

版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp