Java代写 | 4483/8995 Software Technology Assignment Part2

University of Canberra

Faculty of Science and Technology

4483 Software Technology 1 and

8995 Software Technology 1 G

Semester WT, 2019

Assignment Part2

(5% of Grade)

 

Due: During tutorial in Week 7 when you can demonstrate it to your tutor for an immediate mark; or submit on Canvas by 11:55 Friday week 7.

If you do a demonstration to your tutor you do not need to submit it to Canvas.

 

Basic Swing Form (Balance of justice)

 

Introduction

 

This part of your main assignment should be done individually; the intention is that all students should attempt this part of the assignment. This assignment consists of writing a program and demonstrating it or submitting it on Canvas. The ‘hints’ and useful code along with the swing tutorial should put this in reach of all students, look at the week 6 and 7 echo recordings on how to get started.

 

NOTE: You can NOT do this using drag and drop in eclipse or some other java development environment. Tutors can check your code to ensure that you placed the controls, coded the listeners and attached them to buttons during the demonstration.

 

GENERAL INSTRUCTIONS

 

Write a simple swing form that has the following features and looks (more or less) like the following:

 

It has two buttons three labels and two text boxes

 

The idea is that it is a balance (or scales) where the sum of the two numbers on the left hand side should equal the sum of the two numbers on the right hand side

 

When the program starts it will chose random integer numbers between 0 and 10 (0 and 10 are allowed) for all 4 numbers. It will also show a neutral “—–“ pattern as the connecting label.

 

If someone types in a value that is not a number, the program should not crash (ie try catch any ParseInt error).

 

The Reset button

Repopulates the four numbers with new random numbers and sets the neutral “—–“ pattern

 

The Balance button

Adds the two numbers on the left hand side, then adds the two numbers on the right hand side

If they are equal display a row of ===

If the sum of the left number is less than the sum of the right numbers display <<<<——

If the sum of the right number is less than the sum of the left numbers display ——>>>>

 

The displays should cover most of the distance between the two sides as shown in my example (ie layout matters though it need not be exact).

 

Example initial state

 

 

Example after I key in some numbers but have not yet pressed Balance

 

Pressed Balance

 

Example LHS (left) is less than RHS (right)

 

 

 

Example RHS (right) is less than LHS (left)

 

What happens if I key in a non-integer

 

 

 

 

 

Marking Rubric

 

No SubmissionZero Marks
Form Displays with no features working2 Marks
Reset button works3 Marks
Balance buttons work4 Marks
It’s tidy and neat, and doesn’t crash on entry of a non-numeric5 Marks
Evidence that a drag and drop environment was usedMaximum of 2.5 marks depending on your judgement of how much code the student wrote

 

You Tutor can mark it quickly and on the spot with a simple demonstration or you can submit it to Canvas with the code and a cover sheet and enough screenshots of all functions for us to be able to mark it:

 

Getting Started

 

It’s fairly Straightforward to code if you have done the Swing Tutorial 1

 

Hints :

  1. First define the GUI class which extends Jframe
  2. Set the frame size
  3. Set it to visible
  4. Add the 3 JLabels
  5. Populate two of them with random numbers
    1. Lookup Math library random function
    2. There is code for a useful random method called rnd in the hint code below
  6. Test it
  7. Add the 2 JTextField (input boxes)
  8. Test it
  9. Add the 2 buttons
  10. Test it
  11. Write listener class for Reset
  12. Connect the listener to the button
  13. Test it
  14. Write listener class for Balance
    1. Sum LHS
    2. Sum RHS
    3. Compare
    4. If necessary use System.out.println to work out why it does not work
  15. Connect the listener to the button
  16. Test it
  17. Drink Vanilla coke (optional step)
  18. Fix formatting of the output
  19. If necessary add try catch blocks to parsing so that it does not crash if I enter z. I used a JOptionPane as an error message but other ways to show the error are ok as well.
  20. Add a title to JFrame
  21. Tidy it up
  22. Test it
  23. Show your tutor (get 5 easy marks)

 

 

 

Below are some code fragments that may be useful:

// *******************************************************

 

 

// *******************************************************

 

JOptionPane.showMessageDialog(null, “Enter a valid integer number please”,

“<< First Number Error >>”,

JOptionPane.ERROR_MESSAGE);

 

 

// *******************************************************

 

 

// *******************************************************

// **** Just some random 1 line code fragments

setVisible(true); //set form visible (last thing in constructor)

getContentPane().setLayout(null);

setTitle(“Assignment WT Part2”)

 

// *******************************************************

 

 


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论