ITECH6401 Enterprise Programming
Assignment 1 – Individual Assignment
Overview
This assignment requires you to analyse a problem and to design and implement a solution, which the user interacts with, via a GUI. The tasks required of your program will require you to demonstrate your understanding of the programming concepts covered in Weeks 1-4 of the course: setting the foundations and a brief introduction to the course and to the Java programming language
Learning Outcomes Assessed
K1. Describe elements of a common object oriented programming language suitable for web based application development
S3. Develop applications involving complex component technology
A1. Design and implement technical solutions addressing connectivity between components
Assessment Details
One of the most important practical uses of prime numbers is in cryptography – if you have ever done any online banking or purchased something online using a credit card then you will have relied heavily on the use of prime numbers in keeping your transaction secure[1].
One of the oldest means of extracting prime numbers is the Sieve of Eratosthenes and this what we shall be using in this assignment.
You are required to write a Java application that finds all the prime numbers2 in a given range. We shall only consider the domain of positive integers: 1,2,3,4 and so on. As this can be a long task, design your program so that it uses threads.
A suggested approach is to generate an array which corresponds to your chosen range of numbers. For example, if you were to consider the range of integers from 1 to 1000 then you would have an array which corresponds to this. The array carries a flag which states whether the corresponding number is prime or not.
For example:
1 2 3 4 5 6 7 8 9 10 11
False |
True |
True |
False |
True |
False |
False |
False |
False |
False |
True |
So the element in the array corresponding to the number 2 states that it is a prime number and the element corresponding to the number 4 states that it is not a prime number.
Begin by starting at the number 1 and when you find a prime test all elements that contain it as a factor and set their label to “False”. Thus starting from the number 1, when you proceed to the number 2, start a thread which divides all the remaining numbers by 2 and which sets their label to “False”. In this example, this will set the numbers 4, 6, 8, and 10 to “False”. Similarly for the following primes.
When all the threads have finished running, print out only the numbers whose label corresponds to “True”.
Task 1
Develop an algorithm in pseudocode.
Task 2
Implement the algorithm in pseudocode Document the code by adding suitable comments and briefly, but clearly, describe how the code works in your report. You might want to use pseudocode, UML[2], screenshots or even animations.
Task 3
Design a suitable GUI which the user interacts with to run the application and see results.
Explain the layout of your GUI and the reasons behind your design.
Implement & test the GUI.
List and explain any Exceptions that you implemented in your application code.
Submission
Your assignment should be completed according to the General Guidelines for Presentation of Academic Work.
The following criteria will be used when marking your assignment:
- successful completion of the required tasks
- quality of code that adheres to the programming standards for the course including:
- comments and documentation
- code layout
- meaningful variable names
- use of constants
You are required to provide documentation, contained in an appropriate file, which includes: • a front page - indicating your name, a statement of what has been completed and acknowledgement of the names of all people (including other students and people outside of the university) who have assisted you and details on what parts of the assignment that they have assisted you with
- details of test data and evidence that the testing was conducted
- list of references used (APA style); please specify if none have been used.
Marking Criteria/Rubric
Tasks |
Marks Allocated | |
Describe how the code works in your report. You might want to use pseudocode, UML[3] and screenshots. Demonstration of correct working of code. Demonstration of the correct use of multithreading. List and explain all the Exceptions that you implemented in your application. Reporting & Presentation[4]. Explain the layout of your GUI and the reasons behind your design. Demonstration of correct working of GUI Suggest any improvements that might be made in a later version |
10 10 20 10 10 10 10 10 10 | |
Total |
100 /20 |
[1] Look at Adam Spencer’s brief but engaging talk on prime numbers: https://www.youtube.com/watch?v=B4xOFsygwr4 2 A prime number is a number whose factors are only 1 and itself, for example, the number 7; remember, 1 is not considered a prime number.
[2] Enterprise Architect is available for this.
[3] Enterprise Architect is available for this.
[4] http://federation.edu.au/current-students/learning-and-study/online-help-with/study-skills-and-writing-guides