DOC

wweek10sol

By Suzanne Price,2014-12-03 10:39
10 views 0
wweek10sol

    CSE2200 System Design and Implementation Week 10 Tutorial Notes

Tutorial Outline:

    This week we will cover the following topics:

; Design Exercises

1) Design Exercises

    Attempt the following exercises

a) A library has the following items stored on its shelves:

     Books ;

    ; Journals

    ; CDs

    ; Conference proceedings

    ; Videos

Some of the above items may be loaned for periods of time, while others may not be loaned.

    Draw a class model to represent the above situation.

    110..*0..*LoanableItemLibrary

    0..10..111

    Video

    Journal

    CDConference ProceedingBook

    Page 1 of 8

    CSE2200 System Design and Implementation Week 10 Tutorial Notes

    Loanable CD Library

     Item Loanable Conf Proc

     Loanable JournalLoanable Item

     Loanable VideoNon-Loanable Item

     LoanableBook

     Non-Loanable Book

     Non-Loanable VideoNon-Loanable Journal

     Non-Loanable CD Non-Loanable Conf Proc

    Page 2 of 8

    CSE2200 System Design and Implementation Week 10 Tutorial Notes

b) SimJungle has a variety of classes that represent the various objects that can exist in the

    Jungle. They are:

    ; Tigers which move, eat Monkeys and can die ; Toucans which can move, eat plants and can die ; Snakes which move, eat Toucans and can die

     Monkeys which can move, eat plants and can die ;

    ; Explorers who can move and name landmarks ; Volcanoes which cannot move and which can explode ; Waterfalls which cannot move and which can flood ; All the objects take it turns to act and perform whatever actions they are designed to

    perform

    Draw a class model to represent the above situation.

    Actor

    Landmark

    Moveable

    AnimalVolcanoWaterfall

    Explorer

    Carnivore

    Herbivore

    TigerSnakeToucanMonkey

    Page 3 of 8

    CSE2200 System Design and Implementation Week 10 Tutorial Notes

c) In our initial analysis of a car rental system, we have come up with the following class

CAR

Attributes Operations

Make rent

    Year insure

    Model

    Colour

    License Plate

    Date of rental

    Date returned from rental

    Kilometres travelled

    Person renting

    Insurance Policy Number

    Date Policy issued

    Company Policy obtained from

    Policy Cost

Is this a good class? If you don’t think it is a good class, what suggestions could you make to

    improve the analysis? If you think it is a good class, why?

    Page 4 of 8

    CSE2200 System Design and Implementation Week 10 Tutorial Notes

    c) What is wrong with the following diagram?

    House

    Bedroom Dining Living Kitchen

    Room Room

Shouldn’t be using inheritance, should use aggregation.

     House

     Living RoomDining RoomKitchenBedroom

    e) What is wrong with the following class diagram?

     Computer Accountable Equipment Asset

     Printer

    Computer EquipmentAccountable Asset

     110..10..1

    Printer

    Page 5 of 8

    CSE2200 System Design and Implementation Week 10 Tutorial Notes

f) A sporting club has asked you to design a system for them to record the various people

    associated with the club. They inform you that they have the following types of people

    associated with them.

; Reserves players

    ; Firsts players

    ; Captains

    ; Coaches

    ; Club Directors

    ; Club Members

    ; Life Members

    ; Honourary Members

    ; Employees

    ; Medical Staff

How would you analyse the above situation to provide the club with a flexible solution.

    PersonClub Role

    1..*1..*

    PlayerCaptainMemberDirectorCoachStaff

    FirstsReservesEmployeeMedical Staff

    HonouraryClubLife

    Page 6 of 8

CSE2200 System Design and Implementation Week 10 Tutorial Notes

    g) You are to design a stock monitoring system for use on the Internet. The system needs to work as follows:

    ; A central server keeps track of the stock prices for all possible stocks ; Each user selects a number of stocks to be on their stock board

    ; Whenever a stock changes price, the price on the user’s stock board is updated if the

    change in price meets certain rules that the user has set, otherwise the stock is updated

    every 10 minutes.

How would you design the system to meet the above requirements?

    Page 7 of 8

CSE2200 System Design and Implementation Week 10 Tutorial Notes

    h) While exploring an old castle, you and a friend discovered a bookcase that you suspected to be the entrance to a secret passageway. While you examined the bookcase, your friend removed a candle from its holder, only to discover that the candle holder was the entrance control. The bookcase rotated half a turn, pushing you along, separating you from your friend. Your friend put the candle back. This time the bookcase rotated a full turn, still leaving you behind it. Your friend took the candle out. The bookcase started to rotate a full turn, but this time you stopped it just short of a full turn by blocking it with your body. Your friend handed you the candle and together you managed to force the bookcase back a half turn, but this left your friend behind it and you in front of it. You put the candle back. As the bookcase began to rotate, you took out the candle, and the candle stopped after a quarter turn. You and your friend then entered to explore further.

    Develop a state diagram for control of the bookcase that is consistent with the previous scenario. What should you have done at first to gain entry with the least trouble?

    [ at north, east, south, or west] ]

     change changeRotatingStoppedStopping do: rotate bookcasedo: rotate bookcase

     [ at north ]

     This exercise demonstrates that even simple state diagrams can lead to complex behaviour. A state diagram that will explain the scenario given in the exercise is shown

     above. A change event occurs whenever the candle is taken out of its holder or wheneverit

    is put back. The condition [at north] is satisfied whenever the bookcase is behind the wall.

    The condition {at north, east, south or west] is satisfied whenever the bookcase is facing

    front, back, or to the side.

     When you first discoverd the bookcase, it was in the Stopped state pointing south. When you friend removed the candle, a change event drove the bookcase into the Rotating state. When the bookcase was pointing north, the condition [at north] put the bookcase

     back into the Stopped state. When your friend re-inserted the candle, another change

    event put the bookcase into the Rotating state until again pointed north. Pulling the

    candle out generated another change event and would have caused the bookcase to rotate a full turn if you had not blocked it with your body. Gorcing the bookcase back is outside the scope of control and does not have to be explained.

     When you put the candle back again, another change event was generated putting the bookcase into the Rotating state once again. Taking the candle back out resulted in yet

     another change event, putting the bookcase into the Stopping state. After 1/4 turn, the

    condition [at north, east, south or west] was satisfied, putting the bookcase into the

    Stopped state.

     What you should have done at first to gain entry was to take the candle out and quickly

    put it back before the bookcase completed a 1/4 turn.

    Page 8 of 8

Report this document

For any questions or suggestions please email
cust-service@docsford.com