25-Comp-A6 Software Engineering · May 2013
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
National Exams — May 2013 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: nine questions, candidates answer any five of the nine (all questions equal weight — each of the five counted questions is worth 20%; only the first five questions as they appear in the answer book are marked). All nine questions are solved below for completeness.
Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, object-oriented and function-oriented design, software testing, dependability and critical systems, reliability metrics, configuration management, real-time software engineering; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process and testing coverage; Gamma, Helm, Johnson & Vlissides, Design Patterns — object-oriented design vocabulary.
Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.
Applying the standard object-oriented design heuristic of extracting candidate objects from the nouns in the problem description, and merging those that turn out to be the same real-world concept, gives the following object model:
Household holds the customer's address and the list of vacation periods during which delivery must be suspended; its behaviour, isOnVacation(date), is consulted by every other object that needs to decide whether a delivery happens on a given day. Publication is an abstract class holding the shared attributes (title, unit price) common to Newspaper (which is sold daily and needs a daily "copies sold" count) and Magazine (which typically has a weekly or monthly issue cycle); factoring the shared behaviour into the Publication superclass and specializing only what differs is a direct application of inheritance to avoid duplicating the pricing and subscription-linking logic in both subclasses. Subscription is the association object linking one household to one publication on one delivery round; its isActiveOn(date) operation combines the household's vacation calendar with the subscription's own start/end dates, and dailyCopiesToday() reports whether this particular subscription contributes a copy to today's total. DeliveryPerson is assigned exactly one DeliveryRound, and its dailyList(date) behaviour asks every subscription on its round whether it is active today and assembles the printed household-by-household list. DeliveryRound aggregates the households on that route in delivery order and provides summaryCounts(date), which sums, per publication, how many active subscriptions across the whole round are due today — this is what produces the "copies of each newspaper sold each day" summary requested. Bill is generated once a month per household by summing that household's active subscriptions' prices over the billing period, and is printed for inclusion with the first delivery of the new month.
isActiveOn).