Pre-SWS task 2009-2010s1
Preparation task (Task A)
Your task is to implement a web application that has the following functionality:
- It must allow the user to specify the details of an online banking transaction.
- The information entered about a transaction must include the following:
- The source account number from which the amount is to be paid, which must be present and be an 8-digit number.
- The destination account number to which the amount is to be paid, which must be present and be an 8-digit number.
- The bank sort code for the source account. This must be in the format two digits, hyphen, two digits, hyphen, two digits, e.g. 43-27-92.
- The bank sort code for the destination account. This must be in the format two digits, hyphen, two digits, hyphen, two digits, e.g. 43-27-92.
- The name associated with the destination account, which must be present.
- The amount of money to be transferred as a number containing at least one digit before the mandatory decimal point, followed by exactly two digits.
- If the user enters a valid transaction, it is added to a list of transactions stored as a session variable. The list of a user's transactions (showing all the above details) is then displayed back to them.
- If the user enters an invalid transaction, the system indicates to the user where invalid data has been entered and provides them with an opportunity to correct it.
Validation of transactions (where possible) is to be done both at the client and at the server side.
The code you produce will form the basis for further development work on the day of the SWS. You will need to hand in the code you write for this exercise as part of the individual assessment of the SWS.
You may either:
- attempt the whole of the above yourself and compare it with the work of other members of your group at the SWS; or
- divide the above work up between members of your group
Advice
- Think carefully about the design of objects to represent the entities. What properties should they have and what type should the properties be? What other operations (methods) should be applicable to each entity?
- The Model-View-Controller (MVC) pattern is a good way of structuring a web application. Think carefully about how you can structure your code to achieve this separation.
- Use the online documentation and your reference books.
- Don't leap into coding. Make sure you have a feasible design for your solution before you start programming it.
- Allow plenty of time to integrate separately developed parts of the program. It is often only at this stage that you find flaws in the design.
- You may reuse code taken from elsewhere (including textbooks and the web), but such code MUST be clearly distinguished and the source of it MUST be acknowledged by a comment in the program listing.
- Develop your code in small parts. Test each part as you implement it. Run your program frequently – don’t add more than about 10-15 lines of code (at maximum) without compiling it to check what you’ve done. Use the breakpoint debugger to run the program to find out whether variables have the values you think they should have. Think carefully about the design of each part of your program. Don’t reject well thought out code just because you get compilation errors – work out why you’ve got an error and correct it, don’t throw away the good with the bad. Don’t be over ambitious.
Constraints
- You must develop your solution using HTML, JavaScript, Java servlets and JSPs as appropriate. You may use Java frameworks as appropriate.
- While your program need not be developed or run in NetBeans, it must be capable of being run in NetBeans.
- Your solution should be written in the languages specified above.
- The assessment will take into account the quality of the structure of your code, so use classes and other features of Java and JavaScript well.
- The code written should be of "good quality", viz. exhibit good layout and readability, and possess good structure (using classes, packages and inheritance where appropriate). User interfaces should be clear and accessible, and require minimum effort on the part of the user to perform the most common operations. The reuse of existing code is encouraged (including publically available/open-source material), but must be acknowledged. Aim to keep the length of your methods short.
Resources
The webapp1 and jpa web applications contain example code that you may find useful in this assessment.
You may find it useful to use some of the Java Collections Framework classes (java.util.*).
Deliverables
- There is no formal deliverable for this task, however you will need to bring an electronic version of your work along to the SWS.