SEEM4570 System Design and Implementation Lecture 12 – Examination Solutions
Use Case Diagrams Use case diagrams are usually referred to as (behavior diagrams) used to describe a set of actions (use cases) that some system or systems (subject) should or can perform in collaboration with one or more external users of the system (actors). Each use case should provide some observable and valuable result to the actors or other stakeholders of the system.
12-13 (Q9) Draw a Use Case Diagram based on the following verbal description by a restaurant manager: "When a customer wants to order food, one of our staff will take care of this customer. The customer may seek help any time in our restaurant. If the customer wants to bill, I (the restaurant manager) will take care of it. Certainly, billing involves bank"
12-13 (Q9) Solution: Restuarant 1 1…* Order Food 1…* 1 1 customer staff extend Seek Help 1 restaurant manager 1 1…* 1…* Bill 1 bank
10-11 (Q2) We are required to develop a grade e-report system. With the system, teachers can record and update grades of students. Teachers should also be able to distribute report sheets. The details are described as follows: • A teacher can record grades. Whenever grades are recorded, they are also saved to disk. • A teacher can update grades. Whenever grades are updated, the existing grade is loaded. Then the updated grade is saved to disk. • A teacher, registrar, and/or a student can view grades. • Whenever any of these people view grades, they must always log on to the system. If their log on fails, they must re-authenticated their user name and password. • A part-time student is a kind of student. • A registrar can generate report sheets. • A teacher can distribute report sheets to students.
10-11 (Q2) Identify all the actors with names. Point out the generalization relationships among the actors if any. Identify the use cases by naming them. Point out all the possible relationships among the use cases. Draw the Use Case Diagram, including all actors, use cases, and relationships. Be sure to use the correct notation and label each element.
10-11 (Q2) Solution: (a) Actors: generation relationship teacher registrar student Part-time student disk Note: generation relationship is used for specializing an abstract actor. For example:
10-11 (Q2) Solution: (b) Use Cases: Generate report sheets Distribute report sheets Record grades Update grades extend extend View grades Log on Re-authentication Condition: log on fails Extension point: Re-authentication https://www.uml-diagrams.org/use-case-extend.html
10-11 (Q2) Solution: (c) E-report system teacher disk registrar Record grades teacher disk Update grades Generate report registrar Distribute report student generation View grades extend extend Log on Re-authentication part-time student condition
Sequence diagram Sequence diagrams describe interactions among classes in terms of an exchange of messages over time. Four component: object, lifeline, message, activation
10-11 (Q4) Sequence Diagram Draw a sequence diagram for the following use case for displaying customer account information. 1 • The customer sends a login request (message) to the home page. • The home page responds by sending a display message to the login page. • The login page then displays itself, and Sends a request to the customer for user ID and password. • The customer responds to the login page by entering user ID and password. • The login page then sends a message to the accounts file, requesting validation of the customer login. • Once validated, the accounts file sends the relevant account information to the home page. • The home page then displays this account information to the customer.
10-11 (Q4) Sequence Diagram Solution:
12-13 (Q10) Sequence Diagram Draw a Sequence Diagram based on the following verbal description by the owner of an online financial company: a "When an investor arrives, he/she can search a financial instrument that we provided. The investor may choose whether or not to invest in that financial instrument and specify how much money he/she wants to invest. Certainly, the investor may repeat the above processes any number of times during his/her visits. "
12-13 (Q10) Sequence Diagram Solution:
09-10 (Q4) Draw a state diagram for a coin phone described as follows: The phone is often hanged up. When it is picked up by a user, it enters the creditng mode. When the user inserts some coins, the credit is added up to the total value of inserted coins. When the credit exceeds some threshold M, the phone enters the numbering mode by giving long beeps. A complete phone number drives the phone to the verification mode. If the time is out for entering the phone number, the phone goes back to the hanged up mode and the remaining coins are returned to the user.
09-10 (Q4) When exiting the numbering mode, the phone always gives short beeps. The phone checks the validity of the input number in the verification mode. If the number is valid, it goes into the ringing mode; otherwise, it is hanged up and remaining coins are returned. If the network is busy, the phone changes from the ringing mode to the hanged up mode and returns remaining coins. Otherwise, it enters the communication mode. During the communication, the credit is decremented by each elapsed time unit. If the credit is less than a threshold C, the phone is hanged up and remaining coins are returned.
09-10 (Q4) Solution: credit <= M picked up credit > M Numbering/long beeps hanged up crediting time out return remaining coins complete input vertification invalid return remaining coins valid not busy credit < C return remaining coins communication rinnging network busy return remaining coins credit >=C Note: When the mode is not numbering, the phone always gives short beeps
09-10 (Q4) Solution: credit <= M picked up credit > M Numbering/long beeps hanged up crediting time out return remaining coins complete input vertification invalid return remaining coins valid not busy credit < C return remaining coins communication rinnging network busy return remaining coins credit >=C Note: When the mode is not numbering, the phone always gives short beeps
Addition Question State Machine Diagram for the following description: a ATM is initially in the turned off state. After the power is turned on, ATM performs startup action and enters Self Test state. If the test fails, ATM goes into Out of Service state, otherwise it transits to the Idle state. The ATM state changes from Idle to Serving Customer when the customer inserts banking card. Note that transition from Serving Customer state back to the Idle state could be triggered by cancel event as the customer could cancel transaction at any time.
Addition Question Solution: Shut down Turned on / start up Test fails Turned off Self Test Out of service Test succeed Failure Cancel Idle Serving customers Card inserted
Class Diagram Describes the structure of a system by showing the system's classes, attributes, and relationships among classes In a class diagram, there are many classes. Each class is represented by a box with three parts: • Top: The name of the class • Middle: The properties/attributes of the class • Bottom: The methods of the class
12-13 (Q8) Class Diagram Draw a class diagram based on the following verbal description by a hotel manager: "Our Hotel offers two types of Room: LuxuryRoom and SuperiorRoom. Room is an abstract idea. The same Guest can register more than one room. A room can have no guest and no more than 3 guests. We record the creditCardNumber of all guests, and this information can be accessed by other components only via a method getCreditCardNumber(). Each hotel room has different price per night. It needs to be recorded down in our system. Some, but not all, superiorRooms has balcony, this information must have to be recorded down. All luxuryRooms are monitored by one and only one securityGuard. A securityGuard is our Employee. Each employee has an employeeID. "
12-13 (Q8) Class Diagram Solution:
09-10 (Q2(a)) Class Diagram Draw a class diagram for an information system of a travel agency based on the following descriptions: The agency can offer four types of services to customers: hotel reservation, flight ticket purchase, car rental, and a combo. In order to provide these services, the agency has three types of partners: hotels, airlines, and car rental companies. For hotel reservation, the agency is in touch with some hotels(identified by names and fees). A customer can book a hotel by providing the hotel name, and dates of arrival and departure. A reservation is associated to one hotel while a hotel may have zero or more reservations. For flight ticket purchase, the agency is in touch with serval airlines(identified by names and hot lines). A customer can book a flight ticket, which contains the information of its expiry date, its fee, cities and dates of departure and arrival. The ticket is issued by one airline while an airline can sell zero or more tickets. For car rental, the agency is in touch with some car rental companies(identified by names and addresses). A customer can rent a car by giving the car brand, car model, dates of departure and arrival. A car rental is associated to one rental company while a company can rent zero or more cars. A combo contains at least two and up to ten services. A customer (identified by name and passport number) can buy one or more services. There is a discount for VIP customers.
09-10 (Q2(a)) Class Diagram Solution:
09-10 (Q2(b)) Class Diagram Consider the class diagram in Figure1. Explain why the association between the classes Account and Entry is a derived association.
09-10 (Q2(b)) Class Diagram Solution: A derived association means that one class’s value is dependent on some other thing. In this class diagram, the balance of an Account is calculated as the sum of Entry amounts.