Question: Suppose you are designing a database for a voting

advertisement
Some Review Question for 92.3913 (Fall 2005)
In your class diagrams, indicate all constraints, multiplicities, and use advanced features
such as generalization/specialization, aggregation, composition, association classes as
you can to represent as many business rules as precisely as you can.
Question: Suppose you are designing a voting application. The business rules are listed
next.
 Suppose the geographical area that is having the election is composed of electoral
districts.
 An electoral district is something that has a name, a description, and comprises many
residences.
 Each electoral district has several candidates that voters will vote for; only one of
these candidates will be declared a winner once the election completes.
 Each candidate is a candidate in only one electoral district, and each candidate has a
name, an address, and a party affiliation. A candidate may or may not be a voter as
well.
 For each person who is eligible to vote, we know their name, birth date, gender,
occupation, and address.
 Each voter has just one vote.
 An address is important; the address identifies a residence.
 Many people may live at the same address, and so we can associate many voters with
an address.
 Each address has a street number, city, province, and postal code
 Each residence belongs to one and only one electoral district.
Design a class model. Assume our application will be used to control voting on election
day. Do not include any implementation attributes.
Question: Consider a course at university that has a capacity for 10 students, and where
there must be at least 5 students for it to be offered. The initial state for the course is
open. When a student registers for the course, the course either remains open, or it
becomes full. The course is full if ten students have registered; after the tenth registration
no one else can register. At any time the Chair could cancel the course. If the course is
full and the term starts the course becomes active. If the course is not full but has at least
five students, then the course becomes active; otherwise the course is cancelled.
Model the course and its states (open, full, etc.) as a statechart diagram
Question: Consider documents that are organized hierarchically (e.g. a text book), and
suppose documents are implemented according to the Composite pattern. In the example
below we have instances of a “unit” class and a “section” class. Sections are leaf nodes in
a tree, sections are internal nodes in a tree. Each unit will have attributes: name, title.
Each section will have attributes name, title, text, number of pages. Each class
implements the operations count() and length(); count() is used to determine the number
of nodes in a tree or subtree, and length() is used to accumulate the number of pages in a
tree or subtree. Create a class model (with no implementation attributes) and show the
messages to be sent for the tree to count itself (i.e. how many nodes exist?), or, for the
tree to count the number of pages.
dm: unit
ch2: unit
ch1: unit
s1:section
s2: section
s3: section
index: section
s4: section
Question: The U of W bookstore has customers, and the bookstore distinquishes three
types of customers: student, staff, and faculty. Since persons who are not students, nor
staff, nor faculty can purchase items at the bookstore, not every customer falls into one of
the three groupings. However, if a customer is in one of the categories, then they are in
only one such category.
All customers have attributes including gender (male, female) and age bracket (young,
old, older).
Because of information obtained from extracts from other systems, the bookstore system
knows of all students, staff, and faculty members. In addition to gender and age, these
have attributes:
student: student id, major, year in major
faculty: faculty id, faculty, department, position
staff: staff id, department, position
The bookstore system knows about all courses; these have two attributes: course number
and title. For each course, the bookstore knows the texts required. A text could be used in
more than one course.
Because the bookstore obtained registration information it knows the courses each
student is registered for.
Because the bookstore has obtained other information it knows the courses that each
faculty member teaches.
Create a domain model with classes, attributes, associations (but no implementation
attributes). Include at least the classes: customer, student, staff, faculty, course.
Question: With a methodology called Extreme Programming, programmers must work in
pairs to develop program components. That is, two programmers decide to work together
in order to develop a program component. For instance, Joe and Wendy have decided to
code the use case named Process Sale.
No program component can be developed unless there are two programmers willing to
work together to develop and test the component. Each programmer has a name, and each
component has a name.
Suppose a program component can be in exactly one of four states: design, coding,
testing, production. Suppose these four are specializations of the programState class.
Using at least classes named Programmer and Component, develop a domain model.
Question: Consider the following Use Case.
An instructor needs to enter his marks for an assignment into the StudentMarking system.
The instructor logs in, the system starts a new session and prompts the instructor for
course and assignment information. The instructor enters the information and the system
verifies the course is in the system. Then the system prompts for the first student’s
student number and mark. The instructor enters the data for the student. The system
confirms the data entered and prompts the instructor for the next student. This continues
until the instructor indicates there are no more students. The system displays the average
of the marks entered. The instructor has completed entering the marks and logs off the
system.
Express the use case as a Sequence Diagram.
Question: Suppose we need a system to keep track of students and their mentors. A
mentor is an advisor for a student, and a mentor is a student. Each student has an
identifier and a name. Each student may be assigned at most one mentor, and any student
could be the mentor for several other students. Create a domain model suitable for this
system.
Question: Draw a single use case model that incorporates the following
 there are 3 actors: instructor, chair and secretary
 instructor is a generalization of chair
 instructor and secretary are specializations of person
 instructors execute the use cases deliver course and develop course
 chairs can execute the use case assign instructor duties
 secretaries execute the use cases update web site and coordinate project day
1. Given the following use case diagram,
Update Lists
secretary
Update Salary
boss
a) list all the use cases that a secretary can execute.
b) list all the use cases that a boss can execute.
Question: Suppose tests for a software system are organized hierarchically into test cases
and test suites. A test case is one test that would be run against the software system. In
the example below you see individual test cases, T1, T2, T3, T4, T5, T6, and T7; test
cases are always at the bottom of these hierarchies. A test suite is a complex structure
comprising test cases and other test suites. In the example below S1, S2, S3, and S4 are
test suites. Note that S3 comprises T2 and T3; S2 comprises S3 and T4; S1 comprises T1,
S2, T5, and S4; S4 comprises T6 and T7.
T5
S4
S2
T1
T6
S3
T2
T3
T4
T7
How would test structures such as these be modeled using the Composite pattern?
(Show the class diagram that would apply in this case)
Question: Suppose we have Use Cases: Reserve A Book, Log In, and Look Up Book.
These are partially defined below.
a) Draw the corresponding use case diagram.
b) Draw the system sequence diagram for Reserve A Book.
Use Case: Reserve A Book
Main Success Scenario
1)
2)
3)
4)
5)
the customer opens the library web page
the customer enters a book identifier
the system displays information about the book
the customer requests the system to place a hold on the book
the system informs the customer that the book is being held and must be
picked up within 24 hours
6) the customer closes the library web page
Alternate flows:
3a. The book cannot be found; Look Up Book is used.
Use Case: Log In
Trigger: If the customer uses Reserve A Book or Look Up Book, and the customer is
not currently logged in, Log In is executed.
Question: In order to track marriages, a model is proposed:
Male
1...*
1...*
Female
Marriage
The Marriage association class keeps track of the day and time of the marriage
ceremony.
The analyst noted the following needs/requirements:




many persons do not marry,
many persons marry more than once,
the same two persons may even marry each other more than once,
marriages are always between one Male and one Female
The above model does not meet all the requirements discovered by the analyst.
a) Discuss which of these requirements the model handles.
b) How would you modify the model to cover all the requirements.
c) Assume there are three people named John, Debbie, and April. Illustrate
instances of objects, based on your model in b) above, in an object diagram
where:
 John married Debbie on April 1, 2000
 John married April on Jan 1, 2001
 John re-married Debbie on July 1, 2003
Question: Create an Activity Diagram for the following:
The process of creating a datamart begins with a planning session. Once the planning
session is complete, three streams of activities can start concurrent with one another.
In the first stream there are two sequential activities: 1. technical design and 2.
product selection and installation. The second stream comprises three sequential
activities: 1. dimensional modeling, 2. physical design, and 3. data staging design and
development. The third stream comprises two sequential activities: 1. end-user
application specification and 2. application development. Once these three streams
complete, the last activity deployment can begin.
Download