


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Exam Code(s) 2BF Exam(s) BSc in Business Information Systems Year 2 Module Code(s) MS Module(s) Advanced Application Development II Paper No. Repeat Paper N Special Paper N External Examiner(s) Dr. Danail Ivanov Internal Examiner(s) Dr. Christopher Duke, Mr Martin Hughes
Marks will be awarded for commented code. Marks will be deducted for code that does not adhere to standard Java and JavaBean naming conventions. Duration 2 Hrs No. of Answer books Requirements : Handout MCQ Statistical Tables Graph Paper Other Material No. of Pages 5 Department(s) Business Information Systems
Question 1: 33 Marks Part A 9 Marks With reference to class members (methods and instance variables), explain how access modifiers can be used to implement encapsulation. Part B 24 Marks Download ‘Q1_Part_B’ from the MS221SumerExam repository and compile it. It contains a class called OneMethod which has a single unimplemented method called getEvent that returns a String. Given an integer month (e.g. 1 is January, 12 is December) we want to implement this method so that it checks whether an Astronomical Event will occur in the selected month. The table below shows the months of the year and the associated astronomical event: Month Astronomical Event 3 or 9 “Equinox” 6 or 12 “Solstice” 1, 2, 4, 5, 7, 8, 10, 11 “No event” Any number outside the range of 1 to 12 “Invalid Month” Your task is to implement the getEvent method so that when we call getEvent(12) the method returns the String “Solstice”, when we call getEvent(4) it returns the String “No event” and so on. You should write a series of positive and negative Unit Tests in the OneMethodTest class that ensure that your getEvent method is working as you would expect it to. Continued overleaf
Question 4: 33 Marks Part A 10 Marks Define the terms ‘coupling’ and ‘cohesion’. Explain why Java programmers aim to write classes that are loosely coupled and highly cohesive. How does using responsibility driven design help them achieve this aim? Part B 15 Marks Download ‘Q4_Part_B’ from the MS221SumerExam repository and compile it. Write a walkthrough that provides a line by line account of what happens when the main method in the Calculator class runs. Your walkthrough should follow the logical flow of the program and highlight the following: