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