test questions
Name: _______________________________________________________________________________
Design of Software Systems
The following specifications are to be used for developing a design in this examination:
You have been recently hired by an online company to develop and implement an online scientific calculator. The following specifications describe the initial delivery of the desired system.
The system’s user interface shall be graphical based.
The system’s user interface shall be accessible via an online webpage.
The system’s user interface shall display buttons to represent the elements of the calculator, such as numbers and operations.
The system’s functionality will support entering numeric digits in the range of 0-9 and up to 32 digits.
The system’s functionality will allow entering decimal numbers using the “.” to delimit the whole number from the fractional number.
The system’s functionality will support the following arithmetic operations:
• Addition • Subtraction • Multiplication • Division
The system’s functionality will support the following advanced scientific operations:
• 𝑒" • 𝑙𝑛 • 𝑥& • 𝑥 • log x • sin x • cos x • tan x • n! • 10" • arcsin x • arccos x • arctan x • mod x • inv x
The system’s functionality will support two buttons to reset operations and clear the transcript:
1. A button labeled “C” which will clear all operations. 2. A button labeled “CE” which will clear the last entered operation.
The system will display a textbox with a scrollable bar containing the transcript of operations as they execute.
The system will provide a means to email a transcript of operations to the user’s desired email address.
1) Why is cohesion and coupling important with respect to the design of a system? Fully justify
your answer. Take into consideration this answer when answering the remainder of the exam.
2) Using the CRC Process, create at least 4 classes (including responsibilities and collaborations) for the desired system as described above.
3) Define 3 Contracts for 3 different classes that you created in question 2.
4) Create a collaboration diagram for the classes you created in questions 2 and 3.
5) Using either a top-down approach or a bottom-up approach (but just one, and state which one you are using), sketch a high-level subsystem collaboration graph.
6) In class we discussed Protocols (Detailed Design) for contracts. What is their purpose and why do we do them? For the contract of multiplication, write the pre and post conditions.
7) Recall the Strategy Design pattern as shown below:
What is the problem that this design pattern is aiming to solve? How will this work with the implementation of the calculator. Explain using concrete examples, i.e. you may draw the UML for this.
8) In class we discussed MVC. What benefits can this provide to us in our calculator implementation? Justify.