10-152-311 - Object-Oriented Programming 1

4.3 Zoo Lab Sequence Diagram: Overview

  1. Create a UML sequence diagram in Violet following these specifications:
    1. The MainWindow has methods fredFeedPlatypusButton_Click() and sallyFeedDingoButton_Click().
    2. Both of these methods follow an identical structure, with only internal details changing between the two. Both will be represented by this sequence diagram.
    3. The MainWindow has a nested object, ComoZoo (Zoo).
    4. The MainWindow also interacts with the guest object which will be returned from the ComoZoo's FindGuest method as shown below.
    5. Both button click methods have to call the following methods:
      1. ComoZoo.CalculateTotalAnimalWeight() (to get the beginning weight). It returns a double.
      2. ComoZoo.FindGuest(). It takes a parameter of name (string). It returns a Guest.
      3. ComoZoo.FindAnimal(). It takes a parameter of type (string). It returns an Animal.
      4. Guest.FeedAnimal(). It takes parameters of animal (Animal) and animalSnackMachine (VendingMachine).
      5. ComoZoo.CalculateTotalAnimalWeight() (to get the ending weight). It returns a double.
    6. Guest has a nested object, Wallet (Wallet).
    7. Guest also interacts with the passed-in animal and animal snack machine.
    8. Guest's FeedAnimal() method must call the following methods:
      1. animalSnackMachine.LookupFoodPrice(). This method takes a parameter of animalType (string). It returns a decimal.
      2. Wallet.RemoveMoney(). This method takes a parameter of amountToRemove (decimal). It returns a decimal.
      3. animalSnackMachine.BuyDingoFood() (if the passed-in animal is a Dingo). This method takes a parameter of payment (decimal). It returns Food.
      4. animalSnackMachine.BuyPlatypusFood() (if the passed-in animal is a Platypus). This method takes a parameter of payment (decimal). It returns a portion of Food.
      5. animal.Eat(). This method takes a parameter of food (Food).
    9. The VendingMachine's BuyDingoFood() method must call the following methods:
      1. this.AddMoney(). This method takes a parameter of amountToAdd (decimal).
      2. this.BuildDingoFoodPacket(). It returns Food.
    10. VendingMachine's BuildDingoFoodPacket() must call this.IsDingoFoodAvailable(). It returns a bool.
    11. The VendingMachine's BuyPlatypusFood() method must call the following methods:
      1. this.AddMoney(). This method takes a parameter of amountToAdd (decimal).
      2. this.BuildPlatypusFoodPacket(). It returns Food.
    12. VendingMachine's BuildPlatypusFoodPacket() must call this.IsPlatypusFoodAvailable(). It returns a bool.
    13. The animal's Eat() method must call the following methods:
      1. this.ShowAffection() (if type is Platypus).
      2. this.BuryBone() (if type is Dingo). This method takes a parameter bone (Food).
      3. this.DigUpAndEatBone() (if type is Dingo).
      4. this.Bark() (if type is Dingo).
  2. Using Violet, export the diagram to a .png file (File, Export to | Image file).
  3. Submit the file via Blackboard.