CS 160: Software Engineering
Sections 1 and 2
Spring Semester 2008
Department of Computer Science
San Jose State University
Instructor: Prof. Ron Mak
Assignment: Use cases
Solution Example
There is, of course,
no single solution. Some points:

|
Project Name: |
Assignment
1: Use Cases |
|
Use Case Name: |
Get Item Price |
|
Authors: |
R. Mak |
1. Goal
|
|
Get the price of a purchase item. |
2. Summary
|
|
The clerk gets the price of an item that
the customer wants to purchase by scanning the item at the supermarket
checkout station. |
3. Actors
|
|
Actor 1: Clerk (primary) Actor 2: Customer Actor 3: Product database |
4. Preconditions
|
|
1. The clerk has successfully logged onto the
supermarket checkout station (use case Login Clerk). 2. The customer has brought an item to
purchase to the checkout station. 3.
The item has a barcode. |
5. Trigger
|
|
The clerk scans the purchase item at the
checkout station. |
6. Primary Sequence
|
|
|
Step |
Action |
|
1 |
The scanner reads the item’s product
code from the barcode. |
|
2 |
The scanner sends the product code to
the product database. |
|
3 |
The product database looks up the
product and returns information such as the name of the product and its
price. |
|
4 |
The checkout station displays the
product name and its price. |
|
5 |
The checkout station adds the item price
to the customer’s running total. |
7. Alternate Sequences
|
|
|
Step |
Action:
Checkout station scanner fails to read product code. |
|
1 |
The clerk enters the product code
manually. |
|
2 |
The clerk submits the just-entered
product code. |
|
Step |
Action:
The product database fails to find the product information. |
|
1 |
The clerk calls for help. |
8. Postconditions
|
|
1.
The purchase item description and price are displayed and the price is
added to the customer’s running total. 2.
The product database records a sale. --- OR --- 3. The customer cannot purchase the item
and the running total and product database are not changed. |
9. Nonfunctional Requirements
|
|
1. A “boop” is audible each time an item is
scanned. 2. Product information is retrieved within 5
seconds. |
10. Glossary
|
|
clerk: the actor who obtains the price of a
purchase item by scanning it customer: the actor who wants to purchase the
item product database: the actor that retrieves product
information based on the product code |
|
Project Name: |
|
|
Use Case Name: |
Pay Debit Card
(with cash back) |
|
Authors: |
R. Mak |
1. Goal
|
|
Pay by debit
card with cash back. |
2.
Summary
|
|
The customer
pays for the purchases with a bank debit card and asks for cash back. |
3.
Actors
|
|
Actor 1: Customer (primary) Actor 2: Clerk Actor 3: Bank |
4.
Preconditions
|
|
1. The total price of all the purchases is
displayed. 2. The customer has successfully swiped the
bank debit card (use case Swipe Debit Card). |
5.
Trigger
|
|
The customer
requests cash back. |
6. Primary
Sequence
|
|
|
Step |
Action |
|
1 |
The customer
enters the desired amount of cash back at the checkout station keypad. |
|
2 |
The station
adds the cash back amount to the customer’s total. |
|
3 |
The station
notifies the customer’s bank of the total amount. |
|
4 |
The bank
deducts the total amount form the customer’s bank account. |
|
5 |
The checkout
station displays the cash back amount. |
|
6 |
The clerk
gives the customer the cash back amount in cash. |
|
7 |
The checkout
station prints the receipt. |
|
8 |
The clerk
hands the receipt to the customer. |
|
9 |
The customer
leaves with the cash and the purchases. |
7.
Alternate Sequences
|
|
|
Step |
Action: Bank account insufficient. |
|
1 |
The checkout
station keypad displays “Insufficient funds in account”. |
|
2 |
The customer
enters a lesser amount for cash back and/or “unpurchases” certain items |
|
Step |
Action: Requested cash back amount
exceeds store policies. |
|
1 |
The checkout
station keypad displays “Problem: Inform clerk”. |
|
2 |
The clerk
tells the customer the maximum allowed cash back amount. |
|
3 |
The customer
enters the maximum cash back amount. |
8. Postconditions
|
|
1. The customer leaves
with purchases and total requested cash back amount. --- OR --- 2. The customer leaves
with purchases and cash back amount less than original request. --- OR --- 3. The customer leaves
with purchases and no cash back. |
9. Nonfunctional Requirements
|
|
1. The checkout station
must respond to the customer’s cash back request within 15 seconds. 2. The clerk must know
the maximum allowed cash back amount. |
10.
Glossary
|
|
customer: the actor who wants to pay for
purchases with a bank debit card and also wants cash back clerk: the actor who handles the transaction bank: the actor that approves the total amount and deducts it
from the customer’s account |