Document version number: 1.05.
(Updated advice on using FileIO.java)
(Updated advice on submission, assessment, and allEqual)
Check the CITS1001 web-site to ensure that you are aware of the latest version.
Submission deadline: 5pm, Friday 20 April 2018.
Value: 10% of CITS1001.
To be done individually.
You should construct a Java program containing your solution to the following problem. You must submit your program electronically using cssubmit. No other method of submission is allowed.
You are expected to have read and understood the University's guidelines on academic conduct. In accordance with this policy, you may discuss with other students the general principles required to understand this project, but the work you submit must be the result of your own effort.
You must submit your project before the submission deadline above. The penalty for late submission is described here.
A number sequence puzzle gives you a sequence of numbers and asks you to supply the next few numbers in the sequence, by inferring the rule that was used to generate the given numbers. For example, what are the next few numbers in the following sequence?
1, 4, 19, 52, ...
This sequence could be generated by the polynomial
x^3 - 4x + 4
in which case the next few numbers would be
109, 196, 319, ...
Every number sequence of length n can be generated by a polynomial of degree n-1 (or less). In this project you will write a Java program that takes a number sequence puzzle as input, and that derives and displays the simplest generating polynomial for that sequence.
The algorithm that you will implement is iterative. Each iteration of the main loop derives one term of the polynomial. For example, starting from the sequence of numbers <1, 1, 5, 13, 25>:
You are required to write three Java classes:
Each link above gives you a skeleton of the required class, including instance variables, constructors, and methods. You are required to complete the methods whose bodies are marked with the comment TODO. Make sure you understand the connections between the classes, and where each method fits into the algorithm described above.
Sequence.java provides the (completed) method solveFileSequences so that you can easily test your program on a file like the sample file. To read files, you also need to download this class:
Add FileIO.java into your project, download project1sample.txt into the same folder, then just apply solveFileSequences to the filename.
Here is a suggested order for tackling the methods, and some tips about specific methods. If we add to this list, we will update the document version number.
Submit your three completed files Term.java, Polynomial.java, and Sequence.java via cssubmit.
Your file names, class names, and method names and signatures must match the specifications exactly. The marking process is partly automated and any deviation in the names or signatures will cause problems, which will be penalised. It is ok to add other methods if you like, as long as you do not change the names or signatures of existing methods.
Common mistakes are to submit .class files in place of .java files, or to submit our test classes in place of your code. If you do one of these, you will be notified as soon as we become aware, but you will be due for any applicable late penalty. It is easy to check your submitted files after you have submitted them - do it!
Your submission will be assessed on
Testing classes are provided for you to validate your program before submission:
Note however that the correctness of your program is your responsibility. The testing classes are (intentionally) quite brief, and a program that passes all of the tests is not guaranteed to be free of errors. "Testing shows the presence, not the absence of bugs." -- E.W. Dijkstra.Feel free to augment the testing classes with more tests of your own. Also compare your program's output with the sample file.
A good place to start wrt clarity is the CSSE Java style guide.
There were 25 marks for correctness, distributed as follows.
Methods were assessed independently, e.g. if your allEqual had a problem, that wouldn't affect other methods that called it. If your method got all green ticks from the marking class, you would have got full marks for that method; otherwise you would have been penalised according to the severity of your error.
There were 5 marks for code clarity. Mostly you would have lost a mark if you did something significant contrary to the CSSE Java style guide, or if the marker deemed that your code for a method was significantly more complicated than it needed to be.
The overall average was 20/30. The distribution of marks is shown below.
This is my solution. Take a look, and compare the way my solution works with the way that yours works.
This is the marking class that was used.
Try out the marking class, and try to understand how your program goes wrong (if it does!). Please direct questions to help1001.
The method testdifferences has a known weakness that we discovered after marking started; it gives out green ticks for some methods that have minor errors. (We have decided to let this weakness go.) There will be a prize** for the first person to email Lyndon with a concise description of this weakness.
**All prizes are awarded or not solely at Lyndon's discretion.
**Update: this prize has been won by Matthew Chidlow. Well done! The weakness is that in all of the tests performed on differences, the argument has the same value as the field variable. Therefore a method that processes the field variable instead of the argument will pass the tests, even though it shouldn't. The version on this page has one extra test which covers this gap; but in marking we will stick with the original version, for equity reasons. We believe that this error will be rare and that it will show up in other tests anyway.
The quickest way to get help with the project is via help1001. You can ask questions, browse previous questions and answers, and discuss all sorts of topics with both staff and other students.
Please read and follow these guidelines.
If you have a question of a personal nature, do not post to help1001: please email Lyndon or Arran instead.
Good luck!