Docstoc

CS12420 - Examination Papers Template

Document Sample
CS12420 - Examination Papers Template Powered By Docstoc
					PRIFYSGOL ABERYSTWYTH – ABERYSTWYTH UNIVERSITY
DEGREE EXAMINATIONS 2009-2010 SEMESTER 2

ABERYSTWYTH
FACULTY OF SCIENCE

Computer Science CS12420: SOFTWARE DEVELOPMENT

Time allowed: 2 hours
Calculators are not allowed in this examination.
This examination is open book. You may either
       use one textbook of your choice and up to 10 sides of A4 or smaller paper (hand-
        written or printed notes) or
       a folder of notes (hand written or printed).
There are two sections to this examination. In SECTION A you are expected to concentrate
on analysing the problem and providing a design. SECTION B is mainly concerned with
detailed algorithm design using Java.
Answer ALL question starting with SECTION A.



SECTION A: ANALYSIS AND DESIGN (allow about 1 hour)

1. Study the following problem statement:

   Your line manager asks you to design and partly implement a small library of classes and
   interfaces that model financial accounts. In particular there must be support for cheque
   accounts and savings accounts.

   There are the business rules to be supported for savings accounts:
           Each account has a balance, e.g. 0.0, 200.50 etc. This must at all times be greater
            or equal to 0.0, that is, it cannot be negative. This must be respected by all the
            following rules and if an attempt is made to violate this rule then a suitable error
            indicator should be used.
           The balance can be obtained or reset. Resetting the balance replaces the previous
            value.
           A deposit can be made which will result in the current balance being
            incremented.
           A withdrawal can be made which will result in the current balance being
            decremented.
           No overdrafts are allowed for savings accounts.




                                                   Page 1 of 2                                  Turn over
   These are the business rules to be supported for current accounts:
           Each account may have an associated overdraft limit which can be set to any
            value greater or equal to 0.0.
           Each account has a balance, e.g. -10.0, 0.0, 200.50 etc. This must at all times be
            greater or equal to the sum of zero minus the overdraft limit.
           The balance can be obtained or reset. Resetting the balance replaces the previous
            value.
           A deposit can be made which will result in the current balance being
            incremented.
           A withdrawal can be made which will result in the current balance being
            decremented.
   a) Write the code for a Java interface called Account that will be used as the common
      interface to be implemented by current accounts and savings accounts. [20 MARKS]
   b) Draw a UML class diagram that represents a suitable design for the given problem.
      Include any relationships, methods and attributes. It is important to use correct UML
      notation.                                                                           [20]
   c) Write a paragraph of text that provides rationale for the design chosen.                [10]


SECTION B: DETAILED DESIGN (allow about 1 hour)

2. In the following you are required to write Java code in the booklets provided, and not
   pseudocode. However, we are particularly interested in your ability to do detailed design,
   such as designing algorithms correctly rather than perfect Java syntax. Note that it is
   important that your code conforms to your design from Section A.
   a) Write some Java code that implements the deposit and withraw operations for current
      accounts and savings accounts. You do not need to implement other operations,
      although you are required embed any methods you write within appropriate class
      definitions. Ensure that appropriate error handling is included and that Java packages
      are used.                                                                   [25 MARKS]
   b) Using Java code, write a JUnit test class that makes the following assertions:
           If 1.0 is deposited in a savings account that has an initial balance of 1.0 then it
            will have a resulting balance of 2.0.
           If 1.01 is withdrawn from a savings account that has an initial balance of 1.0 then
            it should raise an appropriate error.                                           [25]




                                                   Page 2 of 2

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:11
posted:2/7/2011
language:English
pages:2